Implementing an identical JSON.stringify
valentinium at gmail.com
Sun Aug 5 02:14:16 UTC 2018
Is this a question about how/if one could replicate its behavior in theory
from ES code, or are you suggesting a change to the existing behavior for
these exotic cases?
Assuming the former:
The relevant steps are [here](
`instanceof` a value isn’t significant in this algorithm, just its slots
(if it is an object) or its primitive type. So one can handle number and
string by leveraging branded checks as you’ve shown — nothing more is
needed than branded methods and typeof to manage that one.
However it is ultimately not possible to replicate because there is no
possible brand test for [[BooleanData]].
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss