fully async implementations of common utility functions
npm install @r14c/async-utilsdon't block
async-utils is designed to work with the new async syntax to allow you to write non-blocking
code that looks synchronous. functions like Array.prototype.map() are very useful, but
operating over large collections will always block. async-utils rethinks a full range of
useful tools to work with the event loop rather than against it.
contributors welcome! please email a patch or pull request to a
maintainer and we'll get your changes merged as quickly as possible.
compute a the checksum of a javascript object.
Promise.<any> ⏏execute a chain of async operations using the return value of each function
as the argument for the next
function ⏏cache namespace cosntructor
the passed identity function is used to track which function made a
particular call so it can be associated with the cache. by default, memoize
uses the included checksum function.
schedule a task to run on nextTick
Promise ⏏Kind: global method of fork
| Param | Type |
| --- | --- |
| fns | Array.<function(value)> |
| predicate | any |
* memoize
* [Memoize([identity])](#exp_module_memoize--Memoize) ⇒ function ⏏
* ~memoize(fn, args, ttl)
* .clear(cacheGroup)
identity function is used to track which function made aKind: global method of memoize
Returns: function - cache instance
See: checksum
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [identity] | function | | optional identity function |
#### Memoize~memoize(fn, args, ttl)
cache the result of a function call in memory.
Kind: inner method of Memoize
| Param | Type | Description |
| --- | --- | --- |
| fn | function | the function that is being memoized |
| args | array | arguments that should be passed into fn |
| ttl | number \| Object | time to live value and cache group |
##### memoize.clear(cacheGroup)
evict a group of cached objects
Kind: static method of memoize
| Param | Type |
| --- | --- |
| cacheGroup | string |
Kind: global method of microTask
| Param | Type |
| --- | --- |
| fn | function |
to | Param | Type |
| --- | --- |
| promise | Promise |