CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
applyEach.js57 linesDownload Raw Back to async
1'use strict';2 3Object.defineProperty(exports, "__esModule", {4    value: true5});6 7var _applyEach = require('./internal/applyEach.js');8 9var _applyEach2 = _interopRequireDefault(_applyEach);10 11var _map = require('./map.js');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, calling19 * `callback` after all functions have completed. If you only provide the first20 * argument, `fns`, then it will return a function which lets you pass in the21 * arguments as if it were a single function call. If more arguments are22 * provided, `callback` is required while `args` is still optional. The results23 * for each of the applied async functions are passed to the final callback24 * as an array.25 *26 * @name applyEach27 * @static28 * @memberOf module:ControlFlow29 * @method30 * @category Control Flow31 * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s32 * to all call with the same arguments33 * @param {...*} [args] - any number of separate arguments to pass to the34 * function.35 * @param {Function} [callback] - the final argument should be the callback,36 * called when all functions have completed processing.37 * @returns {AsyncFunction} - Returns a function that takes no args other than38 * an optional callback, that is the result of applying the `args` to each39 * of the functions.40 * @example41 *42 * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')43 *44 * appliedFn((err, results) => {45 *     // results[0] is the results for `enableSearch`46 *     // results[1] is the results for `updateSchema`47 * });48 *49 * // partial application example:50 * async.each(51 *     buckets,52 *     async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),53 *     callback54 * );55 */56exports.default = (0, _applyEach2.default)(_map2.default);57module.exports = exports.default;
basant307/AI_Governance_Project · CoolFace