UNPKG

1.33 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _eachOfLimit = require('./eachOfLimit.js');
8
9var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
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 [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
19 *
20 * @name eachOfSeries
21 * @static
22 * @memberOf module:Collections
23 * @method
24 * @see [async.eachOf]{@link module:Collections.eachOf}
25 * @alias forEachOfSeries
26 * @category Collection
27 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
28 * @param {AsyncFunction} iteratee - An async function to apply to each item in
29 * `coll`.
30 * Invoked with (item, key, callback).
31 * @param {Function} [callback] - A callback which is called when all `iteratee`
32 * functions have finished, or an error occurs. Invoked with (err).
33 * @returns {Promise} a promise, if a callback is omitted
34 */
35function eachOfSeries(coll, iteratee, callback) {
36 return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback);
37}
38exports.default = (0, _awaitify2.default)(eachOfSeries, 3);
39module.exports = exports.default;
\No newline at end of file