blob: a2377eab8a015cbd25cc58774e4eb64a53280e46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import everyLimit from './everyLimit';
import doLimit from './internal/doLimit';
/**
* Returns `true` if every element in `coll` satisfies an async test. If any
* iteratee call returns `false`, the main `callback` is immediately called.
*
* @name every
* @static
* @memberOf async
* @alias all
* @category Collection
* @param {Array|Object} coll - A collection to iterate over.
* @param {Function} iteratee - A truth test to apply to each item in the
* collection in parallel. The iteratee is passed a `callback(err, truthValue)`
* which must be called with a boolean argument once it has completed. Invoked
* with (item, callback).
* @param {Function} [callback] - A callback which is called 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).
* @example
*
* async.every(['file1','file2','file3'], function(filePath, callback) {
* fs.access(filePath, function(err) {
* callback(null, !err)
* });
* }, function(err, result) {
* // if result is true then every file exists
* });
*/
export default doLimit(everyLimit, Infinity);
|