mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Revert "merging in faster indexOf patch ... arguably faster than the native implementation, but oh well. #245"
This reverts commit f099038a9d.
This commit is contained in:
@@ -381,13 +381,14 @@
|
||||
// for **isSorted** to use binary search.
|
||||
_.indexOf = function(array, item, isSorted) {
|
||||
if (array == null) return -1;
|
||||
var obj, i = 0;
|
||||
var i, l;
|
||||
if (isSorted) {
|
||||
i = _.sortedIndex(array, item);
|
||||
return array[i] === item ? i : -1;
|
||||
}
|
||||
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
|
||||
while (obj = array[i++]) if (obj === item) return i - 1;
|
||||
var o,i=0;
|
||||
while( o = array[i++] ) if (o === item) return i-1;
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user