mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Add fake source key detection.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -1255,6 +1255,14 @@
|
|||||||
objectProto = context.Object.prototype,
|
objectProto = context.Object.prototype,
|
||||||
stringProto = context.String.prototype;
|
stringProto = context.String.prototype;
|
||||||
|
|
||||||
|
/** Used to detect methods masquerading as native. */
|
||||||
|
var fakeSrcKey = (function() {
|
||||||
|
var shared = context['__core-js_shared__'],
|
||||||
|
uid = /[^.]+$/.exec(shared && shared.keys && shared.keys.IE_PROTO || '');
|
||||||
|
|
||||||
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
||||||
|
}());
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions. */
|
/** Used to resolve the decompiled source of functions. */
|
||||||
var funcToString = context.Function.prototype.toString;
|
var funcToString = context.Function.prototype.toString;
|
||||||
|
|
||||||
@@ -11170,7 +11178,7 @@
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isNative(value) {
|
function isNative(value) {
|
||||||
if (!isObject(value)) {
|
if (!isObject(value) || (fakeSrcKey && fakeSrcKey in value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||||
|
|||||||
Reference in New Issue
Block a user