mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add docs for baseSum and arraySum. [ci skip]
This commit is contained in:
@@ -1699,6 +1699,13 @@
|
|||||||
return false;
|
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) {
|
function arraySum(array) {
|
||||||
var length = array.length,
|
var length = array.length,
|
||||||
result = 0;
|
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) {
|
function baseSum(collection, iteratee) {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
baseEach(collection, function(value, index, collection) {
|
baseEach(collection, function(value, index, collection) {
|
||||||
|
|||||||
Reference in New Issue
Block a user