js-object-clone
js-object-clone copied to clipboard
Include WeakMap shim by default.
https://github.com/Benvie/WeakMap provides a WeakMap implementation for most browsers that don't support it.
Including this with js-object-clone means circular references can be handled by default.
This is just a suggestion, I just manually add the shim myself in my wrapper for js-object-clone.
From the WeakMap shim repo:
Under the hood, WeakMap uses Object.setProperty to create a unique property on each object that is added to a WeakMap, then the value of that property is used as the key to perform lookups into a regular JavaScript Object.
That means it's not suitable when copying objects. On the other side, I don't see why we couldn't use the shimmable Map. There's gonna be no memory leak if we clean and reuse it afterwards.