Projekt

Obecné

Profil

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

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

    
8
var _mapLimit = require('./mapLimit');
9

    
10
var _mapLimit2 = _interopRequireDefault(_mapLimit);
11

    
12
var _baseRange = require('lodash/_baseRange');
13

    
14
var _baseRange2 = _interopRequireDefault(_baseRange);
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 [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a
24
 * time.
25
 *
26
 * @name timesLimit
27
 * @static
28
 * @memberOf module:ControlFlow
29
 * @method
30
 * @see [async.times]{@link module:ControlFlow.times}
31
 * @category Control Flow
32
 * @param {number} count - The number of times to run the function.
33
 * @param {number} limit - The maximum number of async operations at a time.
34
 * @param {AsyncFunction} iteratee - The async function to call `n` times.
35
 * Invoked with the iteration index and a callback: (n, next).
36
 * @param {Function} callback - see [async.map]{@link module:Collections.map}.
37
 */
38
function timeLimit(count, limit, iteratee, callback) {
39
  var _iteratee = (0, _wrapAsync2.default)(iteratee);
40
  (0, _mapLimit2.default)((0, _baseRange2.default)(0, count, 1), limit, _iteratee, callback);
41
}
42
module.exports = exports['default'];
(97-97/105)