Make baseSortedIndex handle NaN correctly when comparing numbers.

This commit is contained in:
John-David Dalton
2014-07-27 13:05:26 -07:00
parent ff4e0cb1c2
commit 4c9f3aee74

View File

@@ -2400,10 +2400,16 @@
high = array ? array.length : low;
value = iterator(value);
var hintNum = typeof value == 'number' ||
(value != null && isFunction(value.valueOf) && typeof value.valueOf() == 'number');
while (low < high) {
var mid = (low + high) >>> 1,
computed = iterator(array[mid]);
if (hintNum && typeof computed != 'undefined') {
computed = +computed || 0;
}
if (retHighest ? computed <= value : computed < value) {
low = mid + 1;
} else {