UNPKG

1.06 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = timesSeries;
7
8var _timesLimit = require('./timesLimit');
9
10var _timesLimit2 = _interopRequireDefault(_timesLimit);
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14/**
15 * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time.
16 *
17 * @name timesSeries
18 * @static
19 * @memberOf module:ControlFlow
20 * @method
21 * @see [async.times]{@link module:ControlFlow.times}
22 * @category Control Flow
23 * @param {number} n - The number of times to run the function.
24 * @param {AsyncFunction} iteratee - The async function to call `n` times.
25 * Invoked with the iteration index and a callback: (n, next).
26 * @param {Function} callback - see {@link module:Collections.map}.
27 * @returns {Promise} a promise, if no callback is provided
28 */
29function timesSeries(n, iteratee, callback) {
30 return (0, _timesLimit2.default)(n, 1, iteratee, callback);
31}
32module.exports = exports['default'];
\No newline at end of file