Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"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

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



I'd like to see the benchmark in the article include the lodash cloneDeep function.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: