davidmarkclements / fast-safe-stringify

Safely and quickly serialize JavaScript objects
MIT License
343 stars 27 forks source link

Force decirc when toJSON with Symbol.for('forceDecirc') #17

Closed mcollina closed 7 years ago

mcollina commented 7 years ago

pino-noir has been broken since https://github.com/davidmarkclements/fast-safe-stringify/pull/14. This adds support for Symbol.for('forceDecirc') to actually force the decirc support even when there is a toJSON function.

davidmarkclements commented 7 years ago

attemp -> attempt

This means fast safe stringify will only work with modern js engines

What if we instead, check the toJSON function for a forceDecirc property

That way support still goes back to node 0.10 and legacy browsers. It also plays nicer where prototypes are concerned - if you put a force decirc symbol on a prototype it will apply that to all toJSON functions. But associating force decirc directly with the toJSON function means guaranteed coupling of toJSON return value and the need to decirc it

mcollina commented 7 years ago

@davidmarkclements updated.

davidmarkclements commented 7 years ago

Not sure if GH or the commit - but I'm still seeing the same code as before

mcollina commented 7 years ago

ouch, didn't push :/. I'll push later today or tomorrow Il giorno sab 20 mag 2017 alle 13:46 David Mark Clements < notifications@github.com> ha scritto:

Not sure if GH or the commit - but I'm still seeing the same code as before

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davidmarkclements/fast-safe-stringify/pull/17#issuecomment-302868190, or mute the thread https://github.com/notifications/unsubscribe-auth/AADL47UcJb84OcWjGA0fqAMeBIX_TWV8ks5r7tKogaJpZM4NgaEt .

mcollina commented 7 years ago

@davidmarkclements updated

davidmarkclements commented 7 years ago

just one more iteration on the docs