1'use strict'; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.default = timesLimit; 7 8var _mapLimit = require('./mapLimit.js'); 9 10var _mapLimit2 = _interopRequireDefault(_mapLimit); 11 12var _range = require('./internal/range.js'); 13 14var _range2 = _interopRequireDefault(_range); 15 16var _wrapAsync = require('./internal/wrapAsync.js'); 17 18var _wrapAsync2 = _interopRequireDefault(_wrapAsync); 19 20function _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 * @returns {Promise} a promise, if no callback is provided 38 */ 39function timesLimit(count, limit, iteratee, callback) { 40 var _iteratee = (0, _wrapAsync2.default)(iteratee); 41 return (0, _mapLimit2.default)((0, _range2.default)(count), limit, _iteratee, callback); 42} 43module.exports = exports['default'];