Sha256: 8e6df1102ebf8b6e3a64a68337a68856c3aab609154bdcdb0ca1c66debf8a773

Contents?: true

Size: 986 Bytes

Versions: 153

Compression:

Stored size: 986 Bytes

Contents

/**
 * 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.
 * @param {Function} iteratee The function invoked per iteration.
 * @param {*} accumulator The initial value.
 * @param {boolean} initFromCollection Specify using the first or last element
 *  of `collection` as the initial value.
 * @param {Function} eachFunc The function to iterate over `collection`.
 * @returns {*} Returns the accumulated value.
 */
function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
  eachFunc(collection, function(value, index, collection) {
    accumulator = initFromCollection
      ? (initFromCollection = false, value)
      : iteratee(accumulator, value, index, collection);
  });
  return accumulator;
}

module.exports = baseReduce;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/internal/baseReduce.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/baseReduce.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/internal/baseReduce.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/internal/baseReduce.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/internal/baseReduce.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/baseReduce.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/internal/baseReduce.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/internal/baseReduce.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseReduce.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseReduce.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseReduce.js