b0bc7469f38a52a98a9e4512bfcdbba94ebe85b3
[yaffs-website] / node_modules / grunt-uncss / node_modules / async / parallelLimit.js
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|Collection} tasks - A collection containing functions to run.
29  * Each function is passed a `callback(err, result)` which it must call on
30  * completion with an error `err` (which can be `null`) and an optional `result`
31  * value.
32  * @param {number} limit - The maximum number of async operations at a time.
33  * @param {Function} [callback] - An optional callback to run once all the
34  * functions have completed successfully. This function gets a results array
35  * (or object) containing all the result arguments passed to the task callbacks.
36  * Invoked with (err, results).
37  */
38 function parallelLimit(tasks, limit, callback) {
39   (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, callback);
40 }
41 module.exports = exports['default'];