timesSeries.js 1.0 KB

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