Make max and min use arrayExtremum instead of their xyzBy counterparts.

This commit is contained in:
John-David Dalton
2015-07-17 08:25:59 -07:00
parent 3c342adb67
commit 51fb82902b

View File

@@ -11037,7 +11037,9 @@
* // => -Infinity
*/
function max(array) {
return maxBy(array, identity);
return (array && array.length)
? arrayExtremum(array, identity, gt, NEGATIVE_INFINITY)
: NEGATIVE_INFINITY;
}
/**
@@ -11092,7 +11094,9 @@
* // => Infinity
*/
function min(array) {
return minBy(array, identity);
return (array && array.length)
? arrayExtremum(array, identity, lt, POSITIVE_INFINITY)
: POSITIVE_INFINITY;
}
/**