CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
forEachLimit.js50 linesDownload Raw Back to async
1'use strict';2 3Object.defineProperty(exports, "__esModule", {4    value: true5});6 7var _eachOfLimit = require('./internal/eachOfLimit.js');8 9var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);10 11var _withoutIndex = require('./internal/withoutIndex.js');12 13var _withoutIndex2 = _interopRequireDefault(_withoutIndex);14 15var _wrapAsync = require('./internal/wrapAsync.js');16 17var _wrapAsync2 = _interopRequireDefault(_wrapAsync);18 19var _awaitify = require('./internal/awaitify.js');20 21var _awaitify2 = _interopRequireDefault(_awaitify);22 23function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }24 25/**26 * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.27 *28 * @name eachLimit29 * @static30 * @memberOf module:Collections31 * @method32 * @see [async.each]{@link module:Collections.each}33 * @alias forEachLimit34 * @category Collection35 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.36 * @param {number} limit - The maximum number of async operations at a time.37 * @param {AsyncFunction} iteratee - An async function to apply to each item in38 * `coll`.39 * The array index is not passed to the iteratee.40 * If you need the index, use `eachOfLimit`.41 * Invoked with (item, callback).42 * @param {Function} [callback] - A callback which is called when all43 * `iteratee` functions have finished, or an error occurs. Invoked with (err).44 * @returns {Promise} a promise, if a callback is omitted45 */46function eachLimit(coll, limit, iteratee, callback) {47    return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);48}49exports.default = (0, _awaitify2.default)(eachLimit, 4);50module.exports = exports.default;
basant307/AI_Governance_Project · CoolFace