Closed mikesamuel closed 5 years ago
I use https://github.com/es-shims/es-shim-api for all my shims/polyfills, which allows for proper shimming but doesn’t do so by default.
https://github.com/mikesamuel/is-template-object should provide something that is compatible with the es-shim-api requirements (see test) but will still need work as far as babel integration to be spec compliant around forgeries.
@ljharb, What is needed above and beyond implementing es-shim-api?
Just writing tests, I guess - the intention is that a compliant package a) has a consistent module interface, b) by default doesn't mutate the environment, c) can give you a "polyfill" in any environment, which is either the native method, or not, depending on how broken it is, and d) can self-install properly when requested explicitly.
Closing. Any other requirements for the polyfill can be collected at its issue tracker.
I don't know about the details of es-shim, but I think it would be best to omit a "shimming" more until this "crosses the threshold".
Polyfills and the evolution of the Web has some advice
So creating a polyfill as an npm package would suffice, and it should not mutate Array regardless of the resolution to issue #7.
As Daniel mentioned, we probably need to distribute it alongside a babel plugin that collects hoisted template objects and registers them with a WeakSet.