ungap / raw-json

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

Fix #3 - Avoid collisions #4

Closed WebReflection closed 1 week ago

WebReflection commented 1 week ago

As rightly pointed out in https://github.com/ungap/raw-json/issues/3 a Map as context was a bad idea due possible collision with numbers rounded to their nearest most representative value:

9007199254740993 === 9007199254740992
// true

Pre-producing context references on already parsed values was not the way to go so that here:

TODO ???

There's possible room to improve repeated sources parsing via an extra map but the current logic is nearly as fast as native Chrome/ium implementation so it'd be probably premature optimization but surely something to keep in mind if anyone would claim faster results ... although I also need to measure that would be the case as it needs O(2) operations (has + get or set because just get might be falsy for false or null or 0)

coveralls commented 1 week ago

Pull Request Test Coverage Report for Build 11342028312

Details


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

💛 - Coveralls