source: imaps-frontend/node_modules/lodash-es/_baseReduce.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 907 bytes
Line 
1/**
2 * The base implementation of `_.reduce` and `_.reduceRight`, without support
3 * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
4 *
5 * @private
6 * @param {Array|Object} collection The collection to iterate over.
7 * @param {Function} iteratee The function invoked per iteration.
8 * @param {*} accumulator The initial value.
9 * @param {boolean} initAccum Specify using the first or last element of
10 * `collection` as the initial value.
11 * @param {Function} eachFunc The function to iterate over `collection`.
12 * @returns {*} Returns the accumulated value.
13 */
14function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
15 eachFunc(collection, function(value, index, collection) {
16 accumulator = initAccum
17 ? (initAccum = false, value)
18 : iteratee(accumulator, value, index, collection);
19 });
20 return accumulator;
21}
22
23export default baseReduce;
Note: See TracBrowser for help on using the repository browser.