Projekt

Obecné

Profil

Stáhnout (1.53 KB) Statistiky
| Větev: | Revize:
1
'use strict';
2

    
3
Object.defineProperty(exports, "__esModule", {
4
  value: true
5
});
6
exports.default = eachLimit;
7

    
8
var _eachOfLimit = require('./internal/eachOfLimit');
9

    
10
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
11

    
12
var _withoutIndex = require('./internal/withoutIndex');
13

    
14
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
15

    
16
var _wrapAsync = require('./internal/wrapAsync');
17

    
18
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
19

    
20
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21

    
22
/**
23
 * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
24
 *
25
 * @name eachLimit
26
 * @static
27
 * @memberOf module:Collections
28
 * @method
29
 * @see [async.each]{@link module:Collections.each}
30
 * @alias forEachLimit
31
 * @category Collection
32
 * @param {Array|Iterable|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 each item in
35
 * `coll`.
36
 * The array index is not passed to the iteratee.
37
 * If you need the index, use `eachOfLimit`.
38
 * Invoked with (item, callback).
39
 * @param {Function} [callback] - A callback which is called when all
40
 * `iteratee` functions have finished, or an error occurs. Invoked with (err).
41
 */
42
function eachLimit(coll, limit, iteratee, callback) {
43
  (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
44
}
45
module.exports = exports['default'];
(50-50/105)