mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Ensure _.max and _.min return the correct value when callback computes +/-Infinity.
This commit is contained in:
@@ -4239,7 +4239,7 @@
|
||||
|
||||
baseEach(collection, function(value, index, collection) {
|
||||
var current = callback(value, index, collection);
|
||||
if (current > computed) {
|
||||
if (current > computed || (current === -Infinity && current === result)) {
|
||||
computed = current;
|
||||
result = value;
|
||||
}
|
||||
@@ -4314,7 +4314,7 @@
|
||||
|
||||
baseEach(collection, function(value, index, collection) {
|
||||
var current = callback(value, index, collection);
|
||||
if (current < computed) {
|
||||
if (current < computed || (current === Infinity && current === result)) {
|
||||
computed = current;
|
||||
result = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user