PluginProbe
Force Refresh / 2.0.0
Force Refresh v2.0.0
3.2.1 3.2.0 3.1.2 3.1.1 3.1.0 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.12.0 All 54 releases
force-refresh / node_modules / handlebars / node_modules / async / detect.js

detect.js in Force Refresh 2.0.0, at node_modules/handlebars/node_modules/async/detect.js

61 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 'use strict';
2
3 Object.defineProperty(exports, "__esModule", {
4 value: true
5 });
6
7 var _identity = require('lodash/identity');
8
9 var _identity2 = _interopRequireDefault(_identity);
10
11 var _createTester = require('./internal/createTester');
12
13 var _createTester2 = _interopRequireDefault(_createTester);
14
15 var _doParallel = require('./internal/doParallel');
16
17 var _doParallel2 = _interopRequireDefault(_doParallel);
18
19 var _findGetResult = require('./internal/findGetResult');
20
21 var _findGetResult2 = _interopRequireDefault(_findGetResult);
22
23 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
25 /**
26 * Returns the first value in `coll` that passes an async truth test. The
27 * `iteratee` is applied in parallel, meaning the first iteratee to return
28 * `true` will fire the detect `callback` with that result. That means the
29 * result might not be the first item in the original `coll` (in terms of order)
30 * that passes the test.
31
32 * If order within the original `coll` is important, then look at
33 * [`detectSeries`]{@link module:Collections.detectSeries}.
34 *
35 * @name detect
36 * @static
37 * @memberOf module:Collections
38 * @method
39 * @alias find
40 * @category Collections
41 * @param {Array|Iterable|Object} coll - A collection to iterate over.
42 * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
43 * The iteratee must complete with a boolean value as its result.
44 * Invoked with (item, callback).
45 * @param {Function} [callback] - A callback which is called as soon as any
46 * iteratee returns `true`, or after all the `iteratee` functions have finished.
47 * Result will be the first item in the array that passes the truth test
48 * (iteratee) or the value `undefined` if none passed. Invoked with
49 * (err, result).
50 * @example
51 *
52 * async.detect(['file1','file2','file3'], function(filePath, callback) {
53 * fs.access(filePath, function(err) {
54 * callback(null, !err)
55 * });
56 * }, function(err, result) {
57 * // result now equals the first file in the list that exists
58 * });
59 */
60 exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default));
61 module.exports = exports['default'];