ungap / raw-json

JSON.rawJSON and isRawJSON ponyfill
MIT License
24 stars 0 forks source link

Add defensive args parsing to stop FUD around this module #2

Closed WebReflection closed 1 week ago

WebReflection commented 1 week ago

In this unfortunate thread https://github.com/mdn/content/pull/36294#issuecomment-2407752579 has been brought up the fact this ungap module is not 100% compliant with native JSON behavior.

Even if it's stated at the top of the ungap documentation that this project doesn't care about paranoia or irrelevant (slow, bloated, etc) extra checks are often not part of the offer:

The main purpose of this project is to help developers move forward, and possibly without unnecessary bloat. This basically means that polyfills are written to support 99% of the use cases, without granting 100% spec compliance.

it was extremely trivial to make it 100% specs compliant and as resilient as core-js counterpart by using (and trapping) once Reflect.apply to guarantee that even in poisoned environment, if this module is imported soon enough everything will just work as expected.

Changes

TODO

That's it ... I might as well just drop Reflct.apply already before merging this MR as I don't really like the premises to have it in.

coveralls commented 1 week ago

Pull Request Test Coverage Report for Build 11308578147

Details


Totals Coverage Status
Change from base Build 11271610914: 0.0%
Covered Lines: 90
Relevant Lines: 90

💛 - Coveralls
WebReflection commented 1 week ago

On the other hand, I can just merge this and move on ... hopefully browsers will implement this soon enough to not worry about performance and Chrome is already shipping this so majority of users will be safe ... I can move on with the next thing, everyone wins, little perf deviation won't matter neither.

Let's publish this as patch 🥳