1'use strict'; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6 7var _eachLimit = require('./eachLimit.js'); 8 9var _eachLimit2 = _interopRequireDefault(_eachLimit); 10 11var _awaitify = require('./internal/awaitify.js'); 12 13var _awaitify2 = _interopRequireDefault(_awaitify); 14 15function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 16 17/** 18 * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. 19 * 20 * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item 21 * in series and therefore the iteratee functions will complete in order. 22 23 * @name eachSeries 24 * @static 25 * @memberOf module:Collections 26 * @method 27 * @see [async.each]{@link module:Collections.each} 28 * @alias forEachSeries 29 * @category Collection 30 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. 31 * @param {AsyncFunction} iteratee - An async function to apply to each 32 * item in `coll`. 33 * The array index is not passed to the iteratee. 34 * If you need the index, use `eachOfSeries`. 35 * Invoked with (item, callback). 36 * @param {Function} [callback] - A callback which is called when all 37 * `iteratee` functions have finished, or an error occurs. Invoked with (err). 38 * @returns {Promise} a promise, if a callback is omitted 39 */ 40function eachSeries(coll, iteratee, callback) { 41 return (0, _eachLimit2.default)(coll, 1, iteratee, callback); 42} 43exports.default = (0, _awaitify2.default)(eachSeries, 3); 44module.exports = exports['default'];