From 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Oct 2019 21:37:45 +0200 Subject: build: Add some required modules for node --- node_modules/lodash/reduceRight.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 node_modules/lodash/reduceRight.js (limited to 'node_modules/lodash/reduceRight.js') diff --git a/node_modules/lodash/reduceRight.js b/node_modules/lodash/reduceRight.js new file mode 100644 index 0000000..e06a7cb --- /dev/null +++ b/node_modules/lodash/reduceRight.js @@ -0,0 +1,36 @@ +var arrayReduceRight = require('./_arrayReduceRight'), + baseEachRight = require('./_baseEachRight'), + baseIteratee = require('./_baseIteratee'), + baseReduce = require('./_baseReduce'), + isArray = require('./isArray'); + +/** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduce + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ +function reduceRight(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduceRight : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); +} + +module.exports = reduceRight; -- cgit v1.2.3