Use es5-shim and es6-shim
ljharb opened this issue · comments
There are many ways that all versions of v8 (all JS engines, in fact) deviate from the spec.
By using the es5-shim
and es6-shim
, you'll ensure that all ES5 and ES6 APIs are spec-compliant and consistent.
I would not recommend using bluebird, because it adds additional methods that are not part of the spec, and it also does not support subclassing in a spec-compliant way. (I'd also recommend object.assign
over object-assign
since it's more spec-compliant, if you end up not wanting the es6-shim
)
i'm not against this, but i'm not sure how to actually use the shims. just require()
them? not really into touching APIs outside of node's.
i don't mind switching Object.assign()
functions. not sure what the differences are.
Yes, just require them, and they'll auto-shim the environment. If you use both es5-shim and es6-shim then you've got a spec-compliant Object.assign
included already, so you could drop object-assign
entirely.
I'd say either you're only patching node
's APIs, or you're also patching native JS APIs (like Object.assign
) - if the latter, patching everything is the way to go imo!
I think we shouldn't do all things in one module, if people really want to patch JS APIs, they can import es5-shim
and es6-shim
independent.
In that case, why does your module bring in Object.assign
?
Our module doesn't monkey-patch Object.assign
, it just brings in a module that does the same thing as Object.assign
.
I feel really strongly that a library shouldn't try and patch the environment.
I truly think a library shouldn't monkey patch the environment, it's an invasive behavior.
I agree - I didn't realize this module didn't shim.
In that case, the es5-shim and es6-shim are not appropriate here (although object.assign
would be). Sorry for the confusion.