-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isNative issues #1197
Comments
Yap, I picked |
Wrapping Object.prototype.toString = 42;
for(var key in {})console.log('key: ' + key); // nothing
Should be in ES3, not constructor, not |
There's bugs in at least some engines where overwriting a built-in does make it enumerable. So there's that. Are you working with @ljharb on your shims? |
Yep, but in old irrelevant engines :) About require('es6-shim');
require('lodash').isNative(Object.keys); // => false
require('lodash').isNative(Object.getPrototypeOf); // => false
require('lodash').isNative(Object.preventExtensions); // => false |
I like using an |
Instead of
I remember one library that wrapped |
Ah ya good old |
…IsNative` to avoid issues with core-js. [closes #1197]
lodash
usesObject#toString
as template forisNative
assuming that is native function. But ES6 changedObject#toString
logic for supportSymbol.toStringTag
.core-js
from first versions adds polyfill for this logic and replacesObject#toString
._.isNative
works wrong for all native functions withcore-js
/babel
and some other libraries:I will add fallback for
lodash
in next versioncore-js
, butlodash
should use native function whose logic shouldn't be changed in ES6+.2.
lodash
usesisNative
for detectSet
,WeakMap
, some object methods - but why? In most polyfills, native methods wrapped for correct work by latest spec and, with this check, will not work withlodash
. Related #981. Better use correct feature detection.The text was updated successfully, but these errors were encountered: