diff options
author | Alex Early <alexander.early@gmail.com> | 2018-09-30 17:00:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-30 17:00:10 -0700 |
commit | 8aecf108b3922bc5211036706a0f6f75e02bd42b (patch) | |
tree | 0f7b6bee315231ef4aefdfbee154822921de231f /lib/someLimit.js | |
parent | df41256f49c9bb3126e035c95aca7860329b6acf (diff) | |
download | async-8aecf108b3922bc5211036706a0f6f75e02bd42b.tar.gz |
feat: await-able Async methods (#1572)
* make each and family awaitable
* dont pretend they're AsyncFunctions
* check errors
* ensure function name is preserved somehow
* awaitable concat
* awaitable detect
* awaitable every/filter
* awaitable groupBy
* awaitable map/mapValues
* awaitable reduce
* awaitable reject
* awaitable some
* awaitable transform
* awaitable times
* awaitable auto
* awaitable compose/seq
* awaitable whilst/until (lol)
* awaitable forever
* awaitable parallel/race
* awaitable retry
* awaitable series (lol)
* awaitable tryEach
* awaitable waterfall (lol)
* lint
* cleanup, remove noop and unused internal functions
Diffstat (limited to 'lib/someLimit.js')
-rw-r--r-- | lib/someLimit.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/someLimit.js b/lib/someLimit.js index fb6841c..2defb28 100644 --- a/lib/someLimit.js +++ b/lib/someLimit.js @@ -1,5 +1,6 @@ import createTester from './internal/createTester'; -import doParallelLimit from './internal/doParallelLimit'; +import eachOfLimit from './internal/eachOfLimit' +import awaitify from './internal/awaitify' /** * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. @@ -21,5 +22,9 @@ import doParallelLimit from './internal/doParallelLimit'; * iteratee returns `true`, or after all the iteratee functions have finished. * Result will be either `true` or `false` depending on the values of the async * tests. Invoked with (err, result). + * @returns {Promise} a promise, if no callback provided */ -export default doParallelLimit(createTester(Boolean, res => res)); +function someLimit(coll, limit, iteratee, callback) { + return createTester(Boolean, res => res)(eachOfLimit(limit), coll, iteratee, callback) +} +export default awaitify(someLimit, 4); |