/
githubmirror
/
lodash
Обзор
Документация
Войти
/
githubmirror
/
lodash
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
4.18.0-amd
_baseSum.js
30 строк
756 B
John-David Dalton
Bump to v4.7.0.
31 мар 2016, 10:33
31 мар 2016, 10:33
d46bcaa
Код
Авторство
О чём код?
define([], function() { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; /** * The base implementation of `_.sum` and `_.sumBy` without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the sum. */ function baseSum(array, iteratee) { var result, index = -1, length = array.length; while (++index < length) { var current = iteratee(array[index]); if (current !== undefined) { result = result === undefined ? current : (result + current); } } return result; } return baseSum; });