mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Make max and min use arrayExtremum instead of their xyzBy counterparts.
This commit is contained in:
@@ -11037,7 +11037,9 @@
|
|||||||
* // => -Infinity
|
* // => -Infinity
|
||||||
*/
|
*/
|
||||||
function max(array) {
|
function max(array) {
|
||||||
return maxBy(array, identity);
|
return (array && array.length)
|
||||||
|
? arrayExtremum(array, identity, gt, NEGATIVE_INFINITY)
|
||||||
|
: NEGATIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11092,7 +11094,9 @@
|
|||||||
* // => Infinity
|
* // => Infinity
|
||||||
*/
|
*/
|
||||||
function min(array) {
|
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