Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = mapValues;
  6. var _mapValuesLimit = require('./mapValuesLimit');
  7. var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. /**
  10. * A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
  11. *
  12. * Produces a new Object by mapping each value of `obj` through the `iteratee`
  13. * function. The `iteratee` is called each `value` and `key` from `obj` and a
  14. * callback for when it has finished processing. Each of these callbacks takes
  15. * two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
  16. * passes an error to its callback, the main `callback` (for the `mapValues`
  17. * function) is immediately called with the error.
  18. *
  19. * Note, the order of the keys in the result is not guaranteed. The keys will
  20. * be roughly in the order they complete, (but this is very engine-specific)
  21. *
  22. * @name mapValues
  23. * @static
  24. * @memberOf module:Collections
  25. * @method
  26. * @category Collection
  27. * @param {Object} obj - A collection to iterate over.
  28. * @param {AsyncFunction} iteratee - A function to apply to each value and key
  29. * in `coll`.
  30. * The iteratee should complete with the transformed value as its result.
  31. * Invoked with (value, key, callback).
  32. * @param {Function} [callback] - A callback which is called when all `iteratee`
  33. * functions have finished, or an error occurs. `result` is a new object consisting
  34. * of each key from `obj`, with each transformed value on the right-hand side.
  35. * Invoked with (err, result).
  36. * @returns {Promise} a promise, if no callback is passed
  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. function mapValues(obj, iteratee, callback) {
  55. return (0, _mapValuesLimit2.default)(obj, Infinity, iteratee, callback);
  56. }
  57. module.exports = exports['default'];