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.

reduceRight.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = reduceRight;
  6. var _reduce = require('./reduce');
  7. var _reduce2 = _interopRequireDefault(_reduce);
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. /**
  10. * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
  11. *
  12. * @name reduceRight
  13. * @static
  14. * @memberOf module:Collections
  15. * @method
  16. * @see [async.reduce]{@link module:Collections.reduce}
  17. * @alias foldr
  18. * @category Collection
  19. * @param {Array} array - A collection to iterate over.
  20. * @param {*} memo - The initial state of the reduction.
  21. * @param {AsyncFunction} iteratee - A function applied to each item in the
  22. * array to produce the next step in the reduction.
  23. * The `iteratee` should complete with the next state of the reduction.
  24. * If the iteratee complete with an error, the reduction is stopped and the
  25. * main `callback` is immediately called with the error.
  26. * Invoked with (memo, item, callback).
  27. * @param {Function} [callback] - A callback which is called after all the
  28. * `iteratee` functions have finished. Result is the reduced value. Invoked with
  29. * (err, result).
  30. * @returns {Promise} a promise, if no callback is passed
  31. */
  32. function reduceRight(array, memo, iteratee, callback) {
  33. var reversed = [...array].reverse();
  34. return (0, _reduce2.default)(reversed, memo, iteratee, callback);
  35. }
  36. module.exports = exports['default'];