MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / baseReduce

Function baseReduce

lib/web/jshint.js:4079–4086  ·  view source on GitHub ↗

* The base implementation of `_.reduce` and `_.reduceRight` without support * for callback shorthands and `this` binding, which iterates over `collection` * using the provided `eachFunc`. * * @private * @param {Array|Object|string} collection The collection to iterate over.

(collection, iteratee, accumulator, initFromCollection, eachFunc)

Source from the content-addressed store, hash-verified

4077 * @returns {*} Returns the accumulated value.
4078 */
4079 function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
4080 eachFunc(collection, function(value, index, collection) {
4081 accumulator = initFromCollection
4082 ? (initFromCollection = false, value)
4083 : iteratee(accumulator, value, index, collection);
4084 });
4085 return accumulator;
4086 }
4087
4088 /**
4089 * The base implementation of `setData` without support for hot loop detection.

Callers 1

createReduceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected