Hacker News new | ask | show | jobs
by FlacoJones 1204 days ago
Where is .cloneDeep? That alone is mainly what I use lodash for.

Even though JS is pass by value, if you pass an object, the other nested objects will still be references to its predecessor.

3 comments

We used `cloneDeep` heavily at a previous role, it isn't particulary fast - so be careful if you cloning very big objects (1mb+). There are faster options out there such as https://github.com/davidmarkclements/rfdc or even https://developer.mozilla.org/en-US/docs/Web/API/structuredC...
I like `fast-copy`. Never had an issue with that.
Technically it's called call-by-sharing.