Hacker News new | ask | show | jobs
by Prefinem 2770 days ago
If you are writing a reviver, what difference is it to instead write a deep clone function?

JSON.parse(JSON.stringify(obj)) !== deepClone(obj)

EDIT: Also, how can you determine if the string should be a date, or a string? Sure, if it fits, you can always convert it to a Date, but if your first object is coming from something that sends ISO Dates as strings and you used JSON.parse with a reviver, you would get a different object.