mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
19 lines
372 B
JavaScript
19 lines
372 B
JavaScript
/**
|
|
* 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;
|
|
|
|
while (length--) {
|
|
result += +array[length] || 0;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
module.exports = arraySum;
|