mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Use arraySum in _.sum.
This commit is contained in:
@@ -11200,7 +11200,7 @@
|
||||
* // => 10
|
||||
*/
|
||||
function sum(array) {
|
||||
return sumBy(array, identity);
|
||||
return array ? arraySum(array, identity) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8708,10 +8708,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
test('`_.sum` should use `_.iteratee` internally', 1, function() {
|
||||
test('`_.sumBy` should use `_.iteratee` internally', 1, function() {
|
||||
if (!isModularize) {
|
||||
_.iteratee = getPropB;
|
||||
strictEqual(_.sum(objects), 1);
|
||||
strictEqual(_.sumBy(objects), 1);
|
||||
_.iteratee = iteratee;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user