root / HServer / 00.Server / 00.Program / node_modules / async / eachLimit.js
이력 | 보기 | 이력해설 | 다운로드 (1.58 KB)
1 | 39 | HKM | '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 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||
17 | |||
18 | /**
|
||
19 | * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
|
||
20 | *
|
||
21 | * @name eachLimit
|
||
22 | * @static
|
||
23 | * @memberOf module:Collections
|
||
24 | * @method
|
||
25 | * @see [async.each]{@link module:Collections.each}
|
||
26 | * @alias forEachLimit
|
||
27 | * @category Collection
|
||
28 | * @param {Array|Iterable|Object} coll - A collection to iterate over.
|
||
29 | * @param {number} limit - The maximum number of async operations at a time.
|
||
30 | * @param {Function} iteratee - A function to apply to each item in `coll`. The
|
||
31 | * iteratee is passed a `callback(err)` which must be called once it has
|
||
32 | * completed. If no error has occurred, the `callback` should be run without
|
||
33 | * arguments or with an explicit `null` argument. The array index is not passed
|
||
34 | * to the iteratee. Invoked with (item, callback). If you need the index, use
|
||
35 | * `eachOfLimit`.
|
||
36 | * @param {Function} [callback] - A callback which is called when all
|
||
37 | * `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
||
38 | */
|
||
39 | function eachLimit(coll, limit, iteratee, callback) { |
||
40 | (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)(iteratee), callback); |
||
41 | } |
||
42 | module.exports = exports['default']; |