mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Make max and min use arrayExtremum instead of their xyzBy counterparts.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user