Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mapValues.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _mapValuesLimit = require('./mapValuesLimit');
  6. var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
  7. var _doLimit = require('./internal/doLimit');
  8. var _doLimit2 = _interopRequireDefault(_doLimit);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
  12. *
  13. * Produces a new Object by mapping each value of `obj` through the `iteratee`
  14. * function. The `iteratee` is called each `value` and `key` from `obj` and a
  15. * callback for when it has finished processing. Each of these callbacks takes
  16. * two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
  17. * passes an error to its callback, the main `callback` (for the `mapValues`
  18. * function) is immediately called with the error.
  19. *
  20. * Note, the order of the keys in the result is not guaranteed. The keys will
  21. * be roughly in the order they complete, (but this is very engine-specific)
  22. *
  23. * @name mapValues
  24. * @static
  25. * @memberOf module:Collections
  26. * @method
  27. * @category Collection
  28. * @param {Object} obj - A collection to iterate over.
  29. * @param {AsyncFunction} iteratee - A function to apply to each value and key
  30. * in `coll`.
  31. * The iteratee should complete with the transformed value as its result.
  32. * Invoked with (value, key, callback).
  33. * @param {Function} [callback] - A callback which is called when all `iteratee`
  34. * functions have finished, or an error occurs. `result` is a new object consisting
  35. * of each key from `obj`, with each transformed value on the right-hand side.
  36. * Invoked with (err, result).
  37. * @example
  38. *
  39. * async.mapValues({
  40. * f1: 'file1',
  41. * f2: 'file2',
  42. * f3: 'file3'
  43. * }, function (file, key, callback) {
  44. * fs.stat(file, callback);
  45. * }, function(err, result) {
  46. * // result is now a map of stats for each file, e.g.
  47. * // {
  48. * // f1: [stats for file1],
  49. * // f2: [stats for file2],
  50. * // f3: [stats for file3]
  51. * // }
  52. * });
  53. */
  54. exports.default = (0, _doLimit2.default)(_mapValuesLimit2.default, Infinity);
  55. module.exports = exports['default'];