X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-legacy-log-utils%2Fnode_modules%2Flodash%2FreduceRight.js;fp=node_modules%2Fgrunt-legacy-log-utils%2Fnode_modules%2Flodash%2FreduceRight.js;h=af62c6c191d242b7c1b32ef181dc758a84a3b1e9;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-legacy-log-utils/node_modules/lodash/reduceRight.js b/node_modules/grunt-legacy-log-utils/node_modules/lodash/reduceRight.js new file mode 100644 index 000000000..af62c6c19 --- /dev/null +++ b/node_modules/grunt-legacy-log-utils/node_modules/lodash/reduceRight.js @@ -0,0 +1,34 @@ +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 _ + * @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. + * @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;