4 ms·
"Deep copy" and "structured clone" are not synonymous. A structured clone is one specific type of deep copy, and it has a variety of quirks. It's not clear to m
by streptomycin 9y ago
"Deep copy" and "structured clone" are not synonymous. A structured clone is one specific type of deep copy, and it has a variety of quirks. It's not clear to me why anyone wants structured clone as opposed to some other kind of deep copy, except if you were polyfilling some API that demands it like I did here https://github.com/dumbmatter/fakeIndexedDB https://github.com/dumbmatter/fakeIndexedDB
There are plenty of more reasonable deep clone functions available, for instance the Lodash one someone posted in another comment https://lodash.com/docs/4.17.4#cloneDeep https://lodash.com/docs/4.17.4#cloneDeep
- Sammi 9y agoI'd like to see the benchmark in the article include the lodash cloneDeep function.