Version 1
[yaffs-website] / node_modules / grunt-legacy-log / node_modules / lodash / collection / reduceRight.js
diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/collection/reduceRight.js b/node_modules/grunt-legacy-log/node_modules/lodash/collection/reduceRight.js
new file mode 100644 (file)
index 0000000..5a5753b
--- /dev/null
@@ -0,0 +1,29 @@
+var arrayReduceRight = require('../internal/arrayReduceRight'),
+    baseEachRight = require('../internal/baseEachRight'),
+    createReduce = require('../internal/createReduce');
+
+/**
+ * This method is like `_.reduce` except that it iterates over elements of
+ * `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @alias foldr
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @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]
+ */
+var reduceRight = createReduce(arrayReduceRight, baseEachRight);
+
+module.exports = reduceRight;