3 Object.defineProperty(exports, "__esModule", {
6 exports.default = reduceRight;
8 var _reduce = require('./reduce');
10 var _reduce2 = _interopRequireDefault(_reduce);
12 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14 var slice = Array.prototype.slice;
17 * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
21 * @memberOf module:Collections
23 * @see [async.reduce]{@link module:Collections.reduce}
25 * @category Collection
26 * @param {Array} array - A collection to iterate over.
27 * @param {*} memo - The initial state of the reduction.
28 * @param {Function} iteratee - A function applied to each item in the
29 * array to produce the next step in the reduction. The `iteratee` is passed a
30 * `callback(err, reduction)` which accepts an optional error as its first
31 * argument, and the state of the reduction as the second. If an error is
32 * passed to the callback, the reduction is stopped and the main `callback` is
33 * immediately called with the error. Invoked with (memo, item, callback).
34 * @param {Function} [callback] - A callback which is called after all the
35 * `iteratee` functions have finished. Result is the reduced value. Invoked with
38 function reduceRight(array, memo, iteratee, callback) {
39 var reversed = slice.call(array).reverse();
40 (0, _reduce2.default)(reversed, memo, iteratee, callback);
42 module.exports = exports['default'];