1 var baseEach = require('./baseEach');
4 * The base implementation of `_.sum` without support for callback shorthands
8 * @param {Array|Object|string} collection The collection to iterate over.
9 * @param {Function} iteratee The function invoked per iteration.
10 * @returns {number} Returns the sum.
12 function baseSum(collection, iteratee) {
14 baseEach(collection, function(value, index, collection) {
15 result += +iteratee(value, index, collection) || 0;
20 module.exports = baseSum;