UNPKG

1.78 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _applyEach = require('./internal/applyEach');
8
9var _applyEach2 = _interopRequireDefault(_applyEach);
10
11var _map = require('./map');
12
13var _map2 = _interopRequireDefault(_map);
14
15function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
17/**
18 * Applies the provided arguments to each function in the array, calling
19 * `callback` after all functions have completed. If you only provide the first
20 * argument, `fns`, then it will return a function which lets you pass in the
21 * arguments as if it were a single function call. If more arguments are
22 * provided, `callback` is required while `args` is still optional.
23 *
24 * @name applyEach
25 * @static
26 * @memberOf module:ControlFlow
27 * @method
28 * @category Control Flow
29 * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s
30 * to all call with the same arguments
31 * @param {...*} [args] - any number of separate arguments to pass to the
32 * function.
33 * @param {Function} [callback] - the final argument should be the callback,
34 * called when all functions have completed processing.
35 * @returns {Function} - If only the first argument, `fns`, is provided, it will
36 * return a function which lets you pass in the arguments as if it were a single
37 * function call. The signature is `(..args, callback)`. If invoked with any
38 * arguments, `callback` is required.
39 * @example
40 *
41 * async.applyEach([enableSearch, updateSchema], 'bucket', callback);
42 *
43 * // partial application example:
44 * async.each(
45 * buckets,
46 * async.applyEach([enableSearch, updateSchema]),
47 * callback
48 * );
49 */
50exports.default = (0, _applyEach2.default)(_map2.default);
51module.exports = exports['default'];
\No newline at end of file