| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 |
|
|---|
| 7 | var _map2 = require('./internal/map.js');
|
|---|
| 8 |
|
|---|
| 9 | var _map3 = _interopRequireDefault(_map2);
|
|---|
| 10 |
|
|---|
| 11 | var _eachOfSeries = require('./eachOfSeries.js');
|
|---|
| 12 |
|
|---|
| 13 | var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
|---|
| 14 |
|
|---|
| 15 | var _awaitify = require('./internal/awaitify.js');
|
|---|
| 16 |
|
|---|
| 17 | var _awaitify2 = _interopRequireDefault(_awaitify);
|
|---|
| 18 |
|
|---|
| 19 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time.
|
|---|
| 23 | *
|
|---|
| 24 | * @name mapSeries
|
|---|
| 25 | * @static
|
|---|
| 26 | * @memberOf module:Collections
|
|---|
| 27 | * @method
|
|---|
| 28 | * @see [async.map]{@link module:Collections.map}
|
|---|
| 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 item in
|
|---|
| 32 | * `coll`.
|
|---|
| 33 | * The iteratee should complete with the transformed item.
|
|---|
| 34 | * Invoked with (item, callback).
|
|---|
| 35 | * @param {Function} [callback] - A callback which is called when all `iteratee`
|
|---|
| 36 | * functions have finished, or an error occurs. Results is an array of the
|
|---|
| 37 | * transformed items from the `coll`. Invoked with (err, results).
|
|---|
| 38 | * @returns {Promise} a promise, if no callback is passed
|
|---|
| 39 | */
|
|---|
| 40 | function mapSeries(coll, iteratee, callback) {
|
|---|
| 41 | return (0, _map3.default)(_eachOfSeries2.default, coll, iteratee, callback);
|
|---|
| 42 | }
|
|---|
| 43 | exports.default = (0, _awaitify2.default)(mapSeries, 3);
|
|---|
| 44 | module.exports = exports.default; |
|---|