Closed mrjjwright closed 3 years ago
I used this library to clone a class hierarchy and everything works perfectly except the Class prototypes are not set properly. Is there any direction you can give me for cloning objects made with classes.
Do I just do the following? This seems to work
class Model { constructor(obj){ Object.assign(this, obj) } } let obj = clone(anotherModel) let m = new Model(obj) // look mom, a cloned Model
I used this library to clone a class hierarchy and everything works perfectly except the Class prototypes are not set properly. Is there any direction you can give me for cloning objects made with classes.