| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = mapValuesSeries;
|
|---|
| 7 |
|
|---|
| 8 | var _mapValuesLimit = require('./mapValuesLimit.js');
|
|---|
| 9 |
|
|---|
| 10 | var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
|
|---|
| 11 |
|
|---|
| 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|---|
| 13 |
|
|---|
| 14 | /**
|
|---|
| 15 | * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time.
|
|---|
| 16 | *
|
|---|
| 17 | * @name mapValuesSeries
|
|---|
| 18 | * @static
|
|---|
| 19 | * @memberOf module:Collections
|
|---|
| 20 | * @method
|
|---|
| 21 | * @see [async.mapValues]{@link module:Collections.mapValues}
|
|---|
| 22 | * @category Collection
|
|---|
| 23 | * @param {Object} obj - A collection to iterate over.
|
|---|
| 24 | * @param {AsyncFunction} iteratee - A function to apply to each value and key
|
|---|
| 25 | * in `coll`.
|
|---|
| 26 | * The iteratee should complete with the transformed value as its result.
|
|---|
| 27 | * Invoked with (value, key, callback).
|
|---|
| 28 | * @param {Function} [callback] - A callback which is called when all `iteratee`
|
|---|
| 29 | * functions have finished, or an error occurs. `result` is a new object consisting
|
|---|
| 30 | * of each key from `obj`, with each transformed value on the right-hand side.
|
|---|
| 31 | * Invoked with (err, result).
|
|---|
| 32 | * @returns {Promise} a promise, if no callback is passed
|
|---|
| 33 | */
|
|---|
| 34 | function mapValuesSeries(obj, iteratee, callback) {
|
|---|
| 35 | return (0, _mapValuesLimit2.default)(obj, 1, iteratee, callback);
|
|---|
| 36 | }
|
|---|
| 37 | module.exports = exports.default; |
|---|