Open benslv opened 2 years ago
Methods cannot be serialized, so they cannot be "cloned". This would be more of a JS "feature", and it won't happen anytime soon, if ever.
It would be great if we can document this limitation in the proto
session
This is not something to document on rfdc's side IMHO. It's completely unrealistic to expect a data serialisation library to be able to serialise logic.
The cloneDeep
method in lodash
could do it but I haven't found anything else that provides a similar capability (yet).
Hmm....the clone library also seems to clone objects properly.
@hood Is RFDC a 'cloning' library or a 'serialization' library?
I ran into a bit of an issue today trying to make a deep copy of a class I had. It turns out
rfdc
doesn't copy over class methods, only its attributes.Not sure if this is a limitation in JS or a feature that could be added to the package?
I made a minimal reproduction of the issue here: