16 ms·
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
by FlacoJones 4y 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.
- contextnavidad 4y agoWe 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 https://github.com/davidmarkclements/rfdc or even https://developer.mozilla.org/en-US/docs/Web/API/structuredClone https://developer.mozilla.org/en-US/docs/Web/API/structuredC...
- phist_mcgee 4y agoTechnically it's called call-by-sharing.
- moogly 4y agoI like `fast-copy`. Never had an issue with that.