concatSeries.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _concatLimit = require('./concatLimit.js');
  6. var _concatLimit2 = _interopRequireDefault(_concatLimit);
  7. var _awaitify = require('./internal/awaitify.js');
  8. var _awaitify2 = _interopRequireDefault(_awaitify);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
  12. *
  13. * @name concatSeries
  14. * @static
  15. * @memberOf module:Collections
  16. * @method
  17. * @see [async.concat]{@link module:Collections.concat}
  18. * @category Collection
  19. * @alias flatMapSeries
  20. * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
  21. * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
  22. * The iteratee should complete with an array an array of results.
  23. * Invoked with (item, callback).
  24. * @param {Function} [callback] - A callback which is called after all the
  25. * `iteratee` functions have finished, or an error occurs. Results is an array
  26. * containing the concatenated results of the `iteratee` function. Invoked with
  27. * (err, results).
  28. * @returns A Promise, if no callback is passed
  29. */
  30. function concatSeries(coll, iteratee, callback) {
  31. return (0, _concatLimit2.default)(coll, 1, iteratee, callback);
  32. }
  33. exports.default = (0, _awaitify2.default)(concatSeries, 3);
  34. module.exports = exports['default'];