mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Use arraySum in _.sum.
This commit is contained in:
@@ -11200,7 +11200,7 @@
|
|||||||
* // => 10
|
* // => 10
|
||||||
*/
|
*/
|
||||||
function sum(array) {
|
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) {
|
if (!isModularize) {
|
||||||
_.iteratee = getPropB;
|
_.iteratee = getPropB;
|
||||||
strictEqual(_.sum(objects), 1);
|
strictEqual(_.sumBy(objects), 1);
|
||||||
_.iteratee = iteratee;
|
_.iteratee = iteratee;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user