basant307/AI_Governance_Project
048
1'use strict';2 3Object.defineProperty(exports, "__esModule", {4 value: true5});6 7var _eachOfLimit2 = require('./internal/eachOfLimit.js');8 9var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);10 11var _wrapAsync = require('./internal/wrapAsync.js');12 13var _wrapAsync2 = _interopRequireDefault(_wrapAsync);14 15var _awaitify = require('./internal/awaitify.js');16 17var _awaitify2 = _interopRequireDefault(_awaitify);18 19function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }20 21/**22 * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a23 * time.24 *25 * @name eachOfLimit26 * @static27 * @memberOf module:Collections28 * @method29 * @see [async.eachOf]{@link module:Collections.eachOf}30 * @alias forEachOfLimit31 * @category Collection32 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.33 * @param {number} limit - The maximum number of async operations at a time.34 * @param {AsyncFunction} iteratee - An async function to apply to each35 * item in `coll`. The `key` is the item's key, or index in the case of an36 * array.37 * Invoked with (item, key, callback).38 * @param {Function} [callback] - A callback which is called when all39 * `iteratee` functions have finished, or an error occurs. Invoked with (err).40 * @returns {Promise} a promise, if a callback is omitted41 */42function eachOfLimit(coll, limit, iteratee, callback) {43 return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback);44}45 46exports.default = (0, _awaitify2.default)(eachOfLimit, 4);47module.exports = exports.default;