Add docs for baseSum and arraySum. [ci skip]

This commit is contained in:
jdalton
2015-03-17 08:48:21 -07:00
parent 2f52730b48
commit 05fd7cecf4

View File

@@ -1699,6 +1699,13 @@
return false;
}
/**
* A specialized version of `_.sum` for arrays without support for iteratees.
*
* @private
* @param {Array} array The array to iterate over.
* @returns {number} Returns the sum.
*/
function arraySum(array) {
var length = array.length,
result = 0;
@@ -2757,6 +2764,15 @@
});
}
/**
* The base implementation of `_.sum` without support for callback shorthands
* and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {number} Returns the sum.
*/
function baseSum(collection, iteratee) {
var result = 0;
baseEach(collection, function(value, index, collection) {