childResult(child) |
Wait for a child process to exit, collecting output, errors, and exit status. |
concat(chunks) |
Concatenate a list of buffers. |
constructorName(val) |
Get the constructor name from an instance. |
defaultWhen(condition, items) |
Return the first element when condition is true and the second element when condition is false. |
defer(ms) |
Resolve after a set amount of time. |
deferUntil(cb, step, max) |
Resolve if cb returns true within max tries, otherwise reject with a TimeoutError . |
deferValue(ms, val) |
Resolve with the given value, after a set amount of time. |
doesExist(val) |
Check if a variable is some T . |
encode(chunks, encoding) |
Concatenate then encode a list of buffers. |
ensureArray(val) |
|
ensureArray(val) |
|
entriesOf(map) |
Get entries of a map-like. |
filterZip(cb, l1) |
Filter and zip some arrays. The cb is called for each slice, which is kept if cb returns true. |
filterZip(cb, l1, l2) |
|
filterZip(cb, l1, l2, l3) |
|
filterZip(cb, l1, l2, l3, l4) |
|
getConstructor(val) |
Get the constructor from an instance. |
getHead(map, key) |
Get the first element from the specified key within a map of lists. |
getHeadOrDefault(map, key, defaultValue) |
Get the first element from the specified key, within a map of lists, or a default value when the key does not exist or is nil. |
getMethods(value) |
Get the methods from an instance and its prototypes. |
getOrDefault(map, key, defaultValue) |
Get a map key or default value when the key does not exist or is nil. |
getTestLogger(verbose) |
Get a test logger. Returns a null logger unless verbose is true or run under debug mode. |
hasItems(val) |
Test if a value is an array with some items (length > 0 ).This is not a general replacement for .length > 0 , since it is also a typeguard: if (hasItems(val)) else { val } will complain that val is never in the else branch, since it was proven not to be an array by this function, even if val is simply empty. |
hasItems(val) |
|
isArray(list) |
Wrapper for Array.isArray with better readonly type handling. |
isArray(list) |
Wrapper for Array.isArray with better readonly type handling. |
isDebug() |
Test if DEBUG mode is set.TODO: check variable value as well |
isEmpty(val) |
Check if a Maybe<Array<T>> does in fact contain an array, and that array has items. |
isNil(val) |
Check if a value is nil. |
isNone(val) |
Typeguard to check if a Maybe is None (null or undefined). |
isSome(val) |
Typeguard to check if a Maybe is Some value (not None ). |
leftPad(val, min, fill) |
Prefix val with fill until it is at least min characters. |
lengthOf(val) |
Calculate the length of an array or value.Arrays return their length, single values return 1, and nil values return 0. This counts the number of elements that setOrPush would add. |
makeDict(map) |
Turns a map or dict into a dict |
makeMap(val) |
Clone a map or map-like object into a new map. |
mergeArray(parts) |
Merge arguments, which may or may not be arrays, into one return that is definitely an array. |
mergeArray(parts) |
|
mergeArrays(parts) |
|
mergeArrays(parts) |
|
mergeMap(target, source) |
Merge the source map into the target map, replacing keys that already exist. |
mustCoalesce(values) |
Return the first value that is not nil. |
mustDefault(values) |
Return the first value that is some T . Throw if they are all None . |
mustExist(val, err) |
Assert that a variable is not None and return the value. Throw if it is None . |
mustFind(list, predicate) |
Find a value matching the given predicate or throw. |
mustGet(map, key) |
Get an element from a Map and guard against nil values. |
normalizeMap(map) |
Normalize a map-like of values into a dict of lists of strings. |
pairsToMap(pairs) |
Turns a list of name-value pairs into a map. |
pushMergeMap(args) |
Merge the provided maps into a new map, merging keys that already exist by pushing new items. |
pushMergeMap(args) |
Merge the provided maps into a new map, merging keys that already exist by pushing new items. |
removeNone(list) |
Remove any null or undefined items from the list. |
setOrPush(map, key, val) |
Set a map key to a new array or push to the existing value. |
signal(signals) |
Wait for an OS signal. |
spyLogger(spies) |
Create a spy logger using the provided methods, which returns itself as a child. ensure all methods are present by extending null logger |
sum(a, b) |
Add numbers. PredicateR2<number, number> |
timeout(ms, inner) |
Reject after a set amount of time if the original promise has not yet resolved. |
toArray(val) |
Copy an existing array-like or convert a single value to an array. |
toArray(val) |
Copy an existing readonly array-like or convert a single value to a readonly array. |
trim(val, max, tail) |
Return the start of val , up to max characters. If val is longer than max and there is room, suffix with tail . |
waitFor(cb, step, tries) |
|
waitForChild(child) |
|
writeInput(stream, value) |
|
writeValue(stream, value) |
|