* 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)
| 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. |