Deep Clone in 🍦 JS
This is my implementation of Deep Cloning an object using pure JS.
Often asked in coding interviews 💀, rarely ever used without a library like lodash.
Supports the following test cases (at least the ones I've thought up so far):
- empty objects (who wouldn't wanna)
- non-objects
- arrays
- simple objects (POJO)
- nested objects
- complex (?) objects (functions, arrays, nested all at once)
Usage
Clone the repo and copy the deepClone() method into your project, then import it as necessary.
License
MIT but hey, it's just a tiny method after all.