You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently naturally set symbol properties (via e.g. x[symbol] = 'foo') are defined under the hood as not enumerable, so they're hidden from Object.keys and for in iterations.
This however has side effect of symbols not being copied as expected via Object.assign and incorrect value being returned for obj.propertyIsEnumerable(symbol).
Fix would be, to make them naturally enumerable (resign from Object.prototype hack), but update Object.keys shim within es5-ext project so it will filter eventual symbols created by polyfill. Additionally for .. in counterpart can be provided as well.
The text was updated successfully, but these errors were encountered:
You cannot make them enumerable because for/in will show them. symbols in ES5 make sense only if assigned as non enumerable, but other methods that deal with descriptors should be aware of the poly.
I've patched propertyIsEnumerable together with defineProperty and defineProperties and now my polyfill works well with Object.assign native or polyfilled.
You can still set non enumerable Symbols when you use defineProperty/ies
forgot to mention that I obviously had to patch Object.getOwnPropertyDescriptor which will return true by default, unless the Symbol hasn't been assigned via defineProperty/ies as non enumerable.
Currently naturally set symbol properties (via e.g.
x[symbol] = 'foo'
) are defined under the hood as not enumerable, so they're hidden from Object.keys and for in iterations.This however has side effect of symbols not being copied as expected via Object.assign and incorrect value being returned for
obj.propertyIsEnumerable(symbol)
.Fix would be, to make them naturally enumerable (resign from Object.prototype hack), but update Object.keys shim within es5-ext project so it will filter eventual symbols created by polyfill. Additionally for .. in counterpart can be provided as well.
The text was updated successfully, but these errors were encountered: