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