[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = eachOfLimit;
|
---|
| 7 |
|
---|
| 8 | var _eachOfLimit2 = require('./internal/eachOfLimit');
|
---|
| 9 |
|
---|
| 10 | var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);
|
---|
| 11 |
|
---|
| 12 | var _wrapAsync = require('./internal/wrapAsync');
|
---|
| 13 |
|
---|
| 14 | var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
---|
| 15 |
|
---|
| 16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 17 |
|
---|
| 18 | /**
|
---|
| 19 | * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
|
---|
| 20 | * time.
|
---|
| 21 | *
|
---|
| 22 | * @name eachOfLimit
|
---|
| 23 | * @static
|
---|
| 24 | * @memberOf module:Collections
|
---|
| 25 | * @method
|
---|
| 26 | * @see [async.eachOf]{@link module:Collections.eachOf}
|
---|
| 27 | * @alias forEachOfLimit
|
---|
| 28 | * @category Collection
|
---|
| 29 | * @param {Array|Iterable|Object} coll - A collection to iterate over.
|
---|
| 30 | * @param {number} limit - The maximum number of async operations at a time.
|
---|
| 31 | * @param {AsyncFunction} iteratee - An async function to apply to each
|
---|
| 32 | * item in `coll`. The `key` is the item's key, or index in the case of an
|
---|
| 33 | * array.
|
---|
| 34 | * Invoked with (item, key, callback).
|
---|
| 35 | * @param {Function} [callback] - A callback which is called when all
|
---|
| 36 | * `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
---|
| 37 | */
|
---|
| 38 | function eachOfLimit(coll, limit, iteratee, callback) {
|
---|
| 39 | (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback);
|
---|
| 40 | }
|
---|
| 41 | module.exports = exports['default']; |
---|