mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Remove native String#contains use in _.contains.
This commit is contained in:
15
lodash.js
15
lodash.js
@@ -719,8 +719,7 @@
|
|||||||
}());
|
}());
|
||||||
|
|
||||||
/* Native method references for those with the same name as other `lodash` methods */
|
/* Native method references for those with the same name as other `lodash` methods */
|
||||||
var nativeContains = isNative(nativeContains = stringProto.contains) && nativeContains,
|
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
|
||||||
nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
|
|
||||||
nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
|
nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
|
||||||
nativeIsFinite = context.isFinite,
|
nativeIsFinite = context.isFinite,
|
||||||
nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
|
nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
|
||||||
@@ -4627,15 +4626,9 @@
|
|||||||
} else {
|
} else {
|
||||||
fromIndex = 0;
|
fromIndex = 0;
|
||||||
}
|
}
|
||||||
if (typeof collection == 'string' || !isArray(collection) && isString(collection)) {
|
return (typeof collection == 'string' || !isArray(collection) && isString(collection))
|
||||||
if (fromIndex >= length) {
|
? (fromIndex < length && collection.indexOf(target, fromIndex) > -1)
|
||||||
return false;
|
: (getIndexOf(collection, target, fromIndex) > -1);
|
||||||
}
|
|
||||||
return nativeContains
|
|
||||||
? nativeContains.call(collection, target, fromIndex)
|
|
||||||
: collection.indexOf(target, fromIndex) > -1;
|
|
||||||
}
|
|
||||||
return getIndexOf(collection, target, fromIndex) > -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user