Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / baseSum.js
1 var baseEach = require('./baseEach');
2
3 /**
4  * The base implementation of `_.sum` without support for callback shorthands
5  * and `this` binding.
6  *
7  * @private
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.
11  */
12 function baseSum(collection, iteratee) {
13   var result = 0;
14   baseEach(collection, function(value, index, collection) {
15     result += +iteratee(value, index, collection) || 0;
16   });
17   return result;
18 }
19
20 module.exports = baseSum;