devalue icon indicating copy to clipboard operation
devalue copied to clipboard

What is the difference between devalue and superjson?

Open martinszeltins opened this issue 1 year ago • 1 comments

I know this is not an "issue" but I don't understand what exactly is the difference between these 2 packages. Which is is better because they seem to do very similar things 😕

martinszeltins avatar Jan 29 '24 09:01 martinszeltins

Functionality difference: superjson supports more types of values out of the box (e.g. classes, symbols, Errors, TypedArrays) that devalue doesn’t support

Safety difference: superjson ignores values it doesn’t support, silently excluding them from the output, whereas devalue throws an error. Erroring is probably better for type safety and predictable behavior, because you’ll be able to notice the error and add a custom replacer

controversial avatar Aug 02 '24 21:08 controversial