Projekt

Obecné

Profil

Stáhnout (1.72 KB) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
'use strict';
2
3
Object.defineProperty(exports, "__esModule", {
4
  value: true
5
});
6
7
var _createTester = require('./internal/createTester');
8
9
var _createTester2 = _interopRequireDefault(_createTester);
10
11
var _doParallel = require('./internal/doParallel');
12
13
var _doParallel2 = _interopRequireDefault(_doParallel);
14
15
var _identity = require('lodash/identity');
16
17
var _identity2 = _interopRequireDefault(_identity);
18
19
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
21
/**
22
 * Returns `true` if at least one element in the `coll` satisfies an async test.
23
 * If any iteratee call returns `true`, the main `callback` is immediately
24
 * called.
25
 *
26
 * @name some
27
 * @static
28
 * @memberOf module:Collections
29
 * @method
30
 * @alias any
31
 * @category Collection
32
 * @param {Array|Iterable|Object} coll - A collection to iterate over.
33
 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
34
 * in the collections in parallel.
35
 * The iteratee should complete with a boolean `result` value.
36
 * Invoked with (item, callback).
37
 * @param {Function} [callback] - A callback which is called as soon as any
38
 * iteratee returns `true`, or after all the iteratee functions have finished.
39
 * Result will be either `true` or `false` depending on the values of the async
40
 * tests. Invoked with (err, result).
41
 * @example
42
 *
43
 * async.some(['file1','file2','file3'], function(filePath, callback) {
44
 *     fs.access(filePath, function(err) {
45
 *         callback(null, !err)
46
 *     });
47
 * }, function(err, result) {
48
 *     // if result is true then at least one of the files exists
49
 * });
50
 */
51
exports.default = (0, _doParallel2.default)((0, _createTester2.default)(Boolean, _identity2.default));
52
module.exports = exports['default'];