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.

map.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _map2 = require('./internal/map');
  6. var _map3 = _interopRequireDefault(_map2);
  7. var _eachOf = require('./eachOf');
  8. var _eachOf2 = _interopRequireDefault(_eachOf);
  9. var _awaitify = require('./internal/awaitify');
  10. var _awaitify2 = _interopRequireDefault(_awaitify);
  11. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12. /**
  13. * Produces a new collection of values by mapping each value in `coll` through
  14. * the `iteratee` function. The `iteratee` is called with an item from `coll`
  15. * and a callback for when it has finished processing. Each of these callback
  16. * takes 2 arguments: an `error`, and the transformed item from `coll`. If
  17. * `iteratee` passes an error to its callback, the main `callback` (for the
  18. * `map` function) is immediately called with the error.
  19. *
  20. * Note, that since this function applies the `iteratee` to each item in
  21. * parallel, there is no guarantee that the `iteratee` functions will complete
  22. * in order. However, the results array will be in the same order as the
  23. * original `coll`.
  24. *
  25. * If `map` is passed an Object, the results will be an Array. The results
  26. * will roughly be in the order of the original Objects' keys (but this can
  27. * vary across JavaScript engines).
  28. *
  29. * @name map
  30. * @static
  31. * @memberOf module:Collections
  32. * @method
  33. * @category Collection
  34. * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
  35. * @param {AsyncFunction} iteratee - An async function to apply to each item in
  36. * `coll`.
  37. * The iteratee should complete with the transformed item.
  38. * Invoked with (item, callback).
  39. * @param {Function} [callback] - A callback which is called when all `iteratee`
  40. * functions have finished, or an error occurs. Results is an Array of the
  41. * transformed items from the `coll`. Invoked with (err, results).
  42. * @returns {Promise} a promise, if no callback is passed
  43. * @example
  44. *
  45. * async.map(['file1','file2','file3'], fs.stat, function(err, results) {
  46. * // results is now an array of stats for each file
  47. * });
  48. */
  49. function map(coll, iteratee, callback) {
  50. return (0, _map3.default)(_eachOf2.default, coll, iteratee, callback);
  51. }
  52. exports.default = (0, _awaitify2.default)(map, 3);
  53. module.exports = exports['default'];