diff options
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); |