source: trip-planner-front/node_modules/async/timesLimit.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = timeLimit;
7
8var _mapLimit = require('./mapLimit');
9
10var _mapLimit2 = _interopRequireDefault(_mapLimit);
11
12var _baseRange = require('lodash/_baseRange');
13
14var _baseRange2 = _interopRequireDefault(_baseRange);
15
16var _wrapAsync = require('./internal/wrapAsync');
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 */
38function 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}
42module.exports = exports['default'];
Note: See TracBrowser for help on using the repository browser.