diff options
Diffstat (limited to 'lib/some.js')
-rw-r--r-- | lib/some.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/some.js b/lib/some.js index 65543bb..378ccdf 100644 --- a/lib/some.js +++ b/lib/some.js @@ -1,5 +1,6 @@ import createTester from './internal/createTester'; -import doParallel from './internal/doParallel'; +import eachOf from './eachOf' +import awaitify from './internal/awaitify' /** * Returns `true` if at least one element in the `coll` satisfies an async test. @@ -21,6 +22,7 @@ import doParallel from './internal/doParallel'; * 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 * @example * * async.some(['file1','file2','file3'], function(filePath, callback) { @@ -31,4 +33,7 @@ import doParallel from './internal/doParallel'; * // if result is true then at least one of the files exists * }); */ -export default doParallel(createTester(Boolean, res => res)); +function some(coll, iteratee, callback) { + return createTester(Boolean, res => res)(eachOf, coll, iteratee, callback) +} +export default awaitify(some, 3); |