|
|
|
|
|
by WorldMaker
3432 days ago
|
|
It's a hack, but `JSON.parse(JSON.stringify(obj))` is a relatively performant deep clone. Very few languages that I know have deep cloning outside of some sort of serialization hack anyway (C#'s deep cloning is a reuse of/leftover from binary marshalling), so this is roughly par for the course, so far as I'm aware. |
|
Relatively short, but IMO not relatively performant. All the JSON encoding/decoding takes its toll.