README.md (13311B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # Async 22 23 > Standard library async utilities. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var ns = require( '@stdlib/utils/async' ); 31 ``` 32 33 #### ns 34 35 Standard library async utilities. 36 37 ```javascript 38 var o = ns; 39 // returns {...} 40 ``` 41 42 <!-- <toc pattern="*"> --> 43 44 <div class="namespace-toc"> 45 46 - <span class="signature">[`anyByRightAsync( collection, [options,] predicate, done )`][@stdlib/utils/async/any-by-right]</span><span class="delimiter">: </span><span class="description">test whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.</span> 47 - <span class="signature">[`anyByAsync( collection, [options,] predicate, done )`][@stdlib/utils/async/any-by]</span><span class="delimiter">: </span><span class="description">test whether at least one element in a collection passes a test implemented by a predicate function.</span> 48 - <span class="signature">[`bifurcateByAsync( collection, [options,] predicate, done )`][@stdlib/utils/async/bifurcate-by]</span><span class="delimiter">: </span><span class="description">split values into two groups according to a predicate function.</span> 49 - <span class="signature">[`composeAsync( ...fcn )`][@stdlib/utils/async/compose]</span><span class="delimiter">: </span><span class="description">function composition.</span> 50 - <span class="signature">[`countByAsync( collection, [options,] indicator, done )`][@stdlib/utils/async/count-by]</span><span class="delimiter">: </span><span class="description">group values according to an indicator function and return group counts.</span> 51 - <span class="signature">[`doUntilAsync( fcn, predicate, done[, thisArg ] )`][@stdlib/utils/async/do-until]</span><span class="delimiter">: </span><span class="description">invoke a function until a test condition is true.</span> 52 - <span class="signature">[`doWhileAsync( fcn, predicate, done[, thisArg ] )`][@stdlib/utils/async/do-while]</span><span class="delimiter">: </span><span class="description">invoke a function while a test condition is true.</span> 53 - <span class="signature">[`everyByRightAsync( collection, [options,] predicate, done )`][@stdlib/utils/async/every-by-right]</span><span class="delimiter">: </span><span class="description">test whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.</span> 54 - <span class="signature">[`everyByAsync( collection, [options,] predicate, done )`][@stdlib/utils/async/every-by]</span><span class="delimiter">: </span><span class="description">test whether all elements in a collection pass a test implemented by a predicate function.</span> 55 - <span class="signature">[`forEachRightAsync( collection, [options,] fcn, done )`][@stdlib/utils/async/for-each-right]</span><span class="delimiter">: </span><span class="description">invoke a function once for each element in a collection, iterating from right to left.</span> 56 - <span class="signature">[`forEachAsync( collection, [options,] fcn, done )`][@stdlib/utils/async/for-each]</span><span class="delimiter">: </span><span class="description">invoke a function once for each element in a collection.</span> 57 - <span class="signature">[`functionSequenceAsync( ...fcn )`][@stdlib/utils/async/function-sequence]</span><span class="delimiter">: </span><span class="description">function sequence.</span> 58 - <span class="signature">[`groupByAsync( collection, [options,] indicator, done )`][@stdlib/utils/async/group-by]</span><span class="delimiter">: </span><span class="description">group values according to an indicator function.</span> 59 - <span class="signature">[`ifelseAsync( predicate, x, y, done )`][@stdlib/utils/async/if-else]</span><span class="delimiter">: </span><span class="description">if a predicate function returns a truthy value, return `x`; otherwise, return `y`.</span> 60 - <span class="signature">[`ifthenAsync( predicate, x, y, done )`][@stdlib/utils/async/if-then]</span><span class="delimiter">: </span><span class="description">if a predicate function returns a truthy value, invoke `x`; otherwise, invoke `y`.</span> 61 - <span class="signature">[`inmapRightAsync( collection, [options,] fcn, done )`][@stdlib/utils/async/inmap-right]</span><span class="delimiter">: </span><span class="description">invoke a function for each element in a collection and update the collection in-place, iterating from right to left.</span> 62 - <span class="signature">[`inmapAsync( collection, [options,] fcn, done )`][@stdlib/utils/async/inmap]</span><span class="delimiter">: </span><span class="description">invoke a function for each element in a collection and update the collection in-place.</span> 63 - <span class="signature">[`mapFunAsync( fcn, n, [options,] done )`][@stdlib/utils/async/map-function]</span><span class="delimiter">: </span><span class="description">invoke a function `n` times and return an array of accumulated function return values.</span> 64 - <span class="signature">[`mapKeysAsync( obj, [options,] transform, done )`][@stdlib/utils/async/map-keys]</span><span class="delimiter">: </span><span class="description">map keys from one object to a new object having the same values.</span> 65 - <span class="signature">[`mapValuesAsync( obj, [options,] transform, done )`][@stdlib/utils/async/map-values]</span><span class="delimiter">: </span><span class="description">map values from one object to a new object having the same keys.</span> 66 - <span class="signature">[`noneByRightAsync( collection, [options,] predicate, done )`][@stdlib/utils/async/none-by-right]</span><span class="delimiter">: </span><span class="description">test whether all elements in a collection fail a test implemented by a predicate function, iterating from right to left.</span> 67 - <span class="signature">[`noneByAsync( collection, [options,] predicate, done )`][@stdlib/utils/async/none-by]</span><span class="delimiter">: </span><span class="description">test whether all elements in a collection fail a test implemented by a predicate function.</span> 68 - <span class="signature">[`reduceRightAsync( collection, initial, [options,] reducer, done )`][@stdlib/utils/async/reduce-right]</span><span class="delimiter">: </span><span class="description">apply a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.</span> 69 - <span class="signature">[`reduceAsync( collection, initial, [options,] reducer, done )`][@stdlib/utils/async/reduce]</span><span class="delimiter">: </span><span class="description">apply a function against an accumulator and each element in a collection and return the accumulated result.</span> 70 - <span class="signature">[`waterfall( fcns, clbk[, thisArg] )`][@stdlib/utils/async/series-waterfall]</span><span class="delimiter">: </span><span class="description">execute functions in series, passing the results of one function as arguments to the next function.</span> 71 - <span class="signature">[`someByRightAsync( collection, n, [options,] predicate, done )`][@stdlib/utils/async/some-by-right]</span><span class="delimiter">: </span><span class="description">test whether a collection contains at least `n` elements which pass a test implemented by a predicate function, iterating from right to left.</span> 72 - <span class="signature">[`someByAsync( collection, n, [options,] predicate, done )`][@stdlib/utils/async/some-by]</span><span class="delimiter">: </span><span class="description">test whether a collection contains at least `n` elements which pass a test implemented by a predicate function.</span> 73 - <span class="signature">[`tabulateByAsync( collection, [options,] indicator, done )`][@stdlib/utils/async/tabulate-by]</span><span class="delimiter">: </span><span class="description">generate a frequency table according to an indicator function.</span> 74 - <span class="signature">[`trycatchAsync( x, y, done )`][@stdlib/utils/async/try-catch]</span><span class="delimiter">: </span><span class="description">if a function does not return an error, invoke a callback with the function result; otherwise, invoke a callback with a value `y`.</span> 75 - <span class="signature">[`trythenAsync( x, y, done )`][@stdlib/utils/async/try-then]</span><span class="delimiter">: </span><span class="description">if a function does not return an error, invoke a callback with the function result; otherwise, invoke a second function.</span> 76 - <span class="signature">[`untilAsync( predicate, fcn, done[, thisArg ] )`][@stdlib/utils/async/until]</span><span class="delimiter">: </span><span class="description">invoke a function until a test condition is true.</span> 77 - <span class="signature">[`whileAsync( predicate, fcn, done[, thisArg ] )`][@stdlib/utils/async/while]</span><span class="delimiter">: </span><span class="description">invoke a function while a test condition is true.</span> 78 79 </div> 80 81 <!-- </toc> --> 82 83 </section> 84 85 <!-- /.usage --> 86 87 <section class="examples"> 88 89 ## Examples 90 91 <!-- TODO: better examples --> 92 93 <!-- eslint no-undef: "error" --> 94 95 ```javascript 96 var objectKeys = require( '@stdlib/utils/keys' ); 97 var ns = require( '@stdlib/utils/async' ); 98 99 console.log( objectKeys( ns ) ); 100 ``` 101 102 </section> 103 104 <!-- /.examples --> 105 106 <section class="links"> 107 108 <!-- <toc-links> --> 109 110 [@stdlib/utils/async/any-by-right]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/any-by-right 111 112 [@stdlib/utils/async/any-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/any-by 113 114 [@stdlib/utils/async/bifurcate-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/bifurcate-by 115 116 [@stdlib/utils/async/compose]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/compose 117 118 [@stdlib/utils/async/count-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/count-by 119 120 [@stdlib/utils/async/do-until]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/do-until 121 122 [@stdlib/utils/async/do-while]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/do-while 123 124 [@stdlib/utils/async/every-by-right]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/every-by-right 125 126 [@stdlib/utils/async/every-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/every-by 127 128 [@stdlib/utils/async/for-each-right]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/for-each-right 129 130 [@stdlib/utils/async/for-each]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/for-each 131 132 [@stdlib/utils/async/function-sequence]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/function-sequence 133 134 [@stdlib/utils/async/group-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/group-by 135 136 [@stdlib/utils/async/if-else]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/if-else 137 138 [@stdlib/utils/async/if-then]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/if-then 139 140 [@stdlib/utils/async/inmap-right]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/inmap-right 141 142 [@stdlib/utils/async/inmap]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/inmap 143 144 [@stdlib/utils/async/map-function]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/map-function 145 146 [@stdlib/utils/async/map-keys]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/map-keys 147 148 [@stdlib/utils/async/map-values]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/map-values 149 150 [@stdlib/utils/async/none-by-right]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/none-by-right 151 152 [@stdlib/utils/async/none-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/none-by 153 154 [@stdlib/utils/async/reduce-right]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/reduce-right 155 156 [@stdlib/utils/async/reduce]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/reduce 157 158 [@stdlib/utils/async/series-waterfall]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/series-waterfall 159 160 [@stdlib/utils/async/some-by-right]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/some-by-right 161 162 [@stdlib/utils/async/some-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/some-by 163 164 [@stdlib/utils/async/tabulate-by]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/tabulate-by 165 166 [@stdlib/utils/async/try-catch]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/try-catch 167 168 [@stdlib/utils/async/try-then]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/try-then 169 170 [@stdlib/utils/async/until]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/until 171 172 [@stdlib/utils/async/while]: https://www.npmjs.com/package/@stdlib/utils/tree/main/async/while 173 174 <!-- </toc-links> --> 175 176 </section> 177 178 <!-- /.links -->