3 ms·
JSON.parse already supports that through the reviver parameter.
by olliej 8y ago
JSON.parse already supports that through the reviver parameter.
- Spivak 8y agoIt doesn't quite do what I'm looking for since it only allows you to transform data after it's already been mapped to a type. So if my integer can't fit into the Number type without loss of precision then my reviver function is going to get the lossy number so it's already to late to do a conversion to BigInt. I need to actually hook into the parser so I can say, "hey when you're about to parse a number pass the token to me and I'll take it from here."