[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = parallelLimit;
|
---|
| 7 |
|
---|
| 8 | var _eachOfLimit = require('./internal/eachOfLimit');
|
---|
| 9 |
|
---|
| 10 | var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
---|
| 11 |
|
---|
| 12 | var _parallel = require('./internal/parallel');
|
---|
| 13 |
|
---|
| 14 | var _parallel2 = _interopRequireDefault(_parallel);
|
---|
| 15 |
|
---|
| 16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 17 |
|
---|
| 18 | /**
|
---|
| 19 | * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a
|
---|
| 20 | * time.
|
---|
| 21 | *
|
---|
| 22 | * @name parallelLimit
|
---|
| 23 | * @static
|
---|
| 24 | * @memberOf module:ControlFlow
|
---|
| 25 | * @method
|
---|
| 26 | * @see [async.parallel]{@link module:ControlFlow.parallel}
|
---|
| 27 | * @category Control Flow
|
---|
| 28 | * @param {Array|Iterable|Object} tasks - A collection of
|
---|
| 29 | * [async functions]{@link AsyncFunction} to run.
|
---|
| 30 | * Each async function can complete with any number of optional `result` values.
|
---|
| 31 | * @param {number} limit - The maximum number of async operations at a time.
|
---|
| 32 | * @param {Function} [callback] - An optional callback to run once all the
|
---|
| 33 | * functions have completed successfully. This function gets a results array
|
---|
| 34 | * (or object) containing all the result arguments passed to the task callbacks.
|
---|
| 35 | * Invoked with (err, results).
|
---|
| 36 | */
|
---|
| 37 | function parallelLimit(tasks, limit, callback) {
|
---|
| 38 | (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, callback);
|
---|
| 39 | }
|
---|
| 40 | module.exports = exports['default']; |
---|