Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / collection / reduceRight.js
1 var arrayReduceRight = require('../internal/arrayReduceRight'),
2     baseEachRight = require('../internal/baseEachRight'),
3     createReduce = require('../internal/createReduce');
4
5 /**
6  * This method is like `_.reduce` except that it iterates over elements of
7  * `collection` from right to left.
8  *
9  * @static
10  * @memberOf _
11  * @alias foldr
12  * @category Collection
13  * @param {Array|Object|string} collection The collection to iterate over.
14  * @param {Function} [iteratee=_.identity] The function invoked per iteration.
15  * @param {*} [accumulator] The initial value.
16  * @param {*} [thisArg] The `this` binding of `iteratee`.
17  * @returns {*} Returns the accumulated value.
18  * @example
19  *
20  * var array = [[0, 1], [2, 3], [4, 5]];
21  *
22  * _.reduceRight(array, function(flattened, other) {
23  *   return flattened.concat(other);
24  * }, []);
25  * // => [4, 5, 2, 3, 0, 1]
26  */
27 var reduceRight = createReduce(arrayReduceRight, baseEachRight);
28
29 module.exports = reduceRight;