Bump to v4.0.0.

This commit is contained in:
John-David Dalton
2015-12-16 17:53:20 -08:00
parent 94d714007e
commit 8c26e6fd4c
656 changed files with 16423 additions and 11602 deletions

View File

@@ -1,19 +1,27 @@
define(['./baseEach'], function(baseEach) {
define([], function() {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/**
* The base implementation of `_.sum` without support for callback shorthands
* and `this` binding.
* The base implementation of `_.sum` without support for iteratee shorthands.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Array} array The array 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) {
result += +iteratee(value, index, collection) || 0;
});
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;
}