mapValuesSeries.js 1.3 KB

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