flightcontrolhq / superjson

Safely serialize JavaScript expressions to a superset of JSON, which includes Dates, BigInts, and more.
https://www.flightcontrol.dev?ref=superjson
MIT License
4.01k stars 87 forks source link

Deserialize should accept `undefined` #48

Closed flybayer closed 3 years ago

flybayer commented 4 years ago

Superjson currently throws an error if you try to deserialize({json: undefined}).

I think it should be a bit more permissive, and if input is undefined, return undefined.

Check out this ugly code I have to write because it doesn't do that 😄 https://github.com/blitz-js/blitz/pull/836/files#diff-6ee56009d994095b978bcddd01afafd8L65-L66

jorisre commented 3 years ago

@Skn0tt This issue is fixed and can be close :)

Skn0tt commented 3 years ago

You're right! Thanks for the heads up :D