mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Fixing indexOf([], undefined, true) to return -1 insead 0
This commit is contained in:
@@ -2404,7 +2404,7 @@
|
||||
fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
|
||||
} else if (fromIndex) {
|
||||
var index = sortedIndex(array, value);
|
||||
return array[index] === value ? index : -1;
|
||||
return (array[index] === value && array.length ? index : -1);
|
||||
}
|
||||
return baseIndexOf(array, value, fromIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user