1
0
Fork 0
js-utils/docs/api/js-utils.md

91 lines
4.8 KiB
Markdown

<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@apextoaster/js-utils](./js-utils.md)
## js-utils package
## Classes
| Class | Description |
| --- | --- |
| [ArrayMapper](./js-utils.arraymapper.md) | |
| [AsyncTracker](./js-utils.asynctracker.md) | Async resource tracker using node's internal hooks.<!-- -->This probably won't work in a browser. It does not hold references to the resource, to avoid leaks. Adapted from https://gist.github.com/boneskull/7fe75b63d613fa940db7ec990a5f5843\#file-async-dump-js |
| [ChildProcessError](./js-utils.childprocesserror.md) | |
| [InvalidArgumentError](./js-utils.invalidargumenterror.md) | |
| [MissingKeyError](./js-utils.missingkeyerror.md) | |
| [NotFoundError](./js-utils.notfounderror.md) | |
| [NotImplementedError](./js-utils.notimplementederror.md) | |
| [TimeoutError](./js-utils.timeouterror.md) | |
## Functions
| Function | Description |
| --- | --- |
| [concat(chunks)](./js-utils.concat.md) | |
| [constructorName(val)](./js-utils.constructorname.md) | |
| [countOf(val)](./js-utils.countof.md) | 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. |
| [defaultWhen(condition, items)](./js-utils.defaultwhen.md) | |
| [defer(ms, val)](./js-utils.defer.md) | Resolve after a set amount of time. |
| [doesExist(val)](./js-utils.doesexist.md) | Check if a variable is not nil. |
| [encode(chunks, encoding)](./js-utils.encode.md) | |
| [entriesOf(map)](./js-utils.entriesof.md) | |
| [filterNil(list)](./js-utils.filternil.md) | Remove any null or undefined items from the list. |
| [getConstructor(val)](./js-utils.getconstructor.md) | |
| [getHead(map, key)](./js-utils.gethead.md) | |
| [getHeadOrDefault(map, key, defaultValue)](./js-utils.getheadordefault.md) | |
| [getMethods(value)](./js-utils.getmethods.md) | |
| [getOrDefault(map, key, defaultValue)](./js-utils.getordefault.md) | |
| [getTestLogger(verbose)](./js-utils.gettestlogger.md) | |
| [isDebug()](./js-utils.isdebug.md) | |
| [isNil(val)](./js-utils.isnil.md) | |
| [leftPad(val, min, fill)](./js-utils.leftpad.md) | |
| [makeDict(map)](./js-utils.makedict.md) | Turns a map or dict into a dict |
| [makeMap(val)](./js-utils.makemap.md) | Clone a map or map-like object into a new map. |
| [mergeList(parts)](./js-utils.mergelist.md) | Merge arguments, which may or may not be arrays, into one return that is definitely an array. |
| [mergeMap(target, source)](./js-utils.mergemap.md) | |
| [mustCoalesce(values)](./js-utils.mustcoalesce.md) | Return the first value that is not nil. |
| [mustExist(val)](./js-utils.mustexist.md) | Assert that a variable is not nil and return the value. |
| [mustFind(list, predicate)](./js-utils.mustfind.md) | Find a value matching the given predicate or throw. |
| [mustGet(map, key)](./js-utils.mustget.md) | Get an element from a Map and guard against nil values. |
| [normalizeMap(map)](./js-utils.normalizemap.md) | |
| [pairsToMap(pairs)](./js-utils.pairstomap.md) | |
| [pushMergeMap(args)](./js-utils.pushmergemap.md) | |
| [removePid(path)](./js-utils.removepid.md) | |
| [setOrPush(map, key, val)](./js-utils.setorpush.md) | Set a map key to a new array or push to the existing value. |
| [signal(signals)](./js-utils.signal.md) | |
| [spyLogger(spies)](./js-utils.spylogger.md) | |
| [timeout(ms, oper)](./js-utils.timeout.md) | Reject after a set amount of time if the original promise has not yet resolved. |
| [trim(val, max, tail)](./js-utils.trim.md) | |
| [waitForChild(child)](./js-utils.waitforchild.md) | |
| [writePid(path)](./js-utils.writepid.md) | |
| [writeValue(stream, value)](./js-utils.writevalue.md) | |
## Interfaces
| Interface | Description |
| --- | --- |
| [ArrayMapperOptions](./js-utils.arraymapperoptions.md) | |
| [ChildOptions](./js-utils.childoptions.md) | |
| [ChildResult](./js-utils.childresult.md) | |
| [Dict](./js-utils.dict.md) | |
| [ExternalModule](./js-utils.externalmodule.md) | |
## Variables
| Variable | Description |
| --- | --- |
| [SIGNAL\_RELOAD](./js-utils.signal_reload.md) | |
| [SIGNAL\_RESET](./js-utils.signal_reset.md) | |
| [SIGNAL\_STOP](./js-utils.signal_stop.md) | |
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [ChildSpawner](./js-utils.childspawner.md) | |
| [MapLike](./js-utils.maplike.md) | A <code>Map</code> or dictionary object with string keys and <code>TVal</code> values. |
| [ModuleCtor](./js-utils.modulector.md) | |
| [Nil](./js-utils.nil.md) | Unset value. |
| [Optional](./js-utils.optional.md) | Value that may be nil. |