JoshuaCWebDeveloper / jcscript

A collection of JavaScripts to aid in the development of JS projects
2 stars 1 forks source link

Consider not copying some types of objects in JCObject.get() #33

Open JoshuaCWebDeveloper opened 5 years ago

JoshuaCWebDeveloper commented 5 years ago

This behavior can cause problems when copying complex objects, such as a DOM element (but I think also for any non-plain object?). Consider only copying plain objects. Alternatively, better document the solution for having complex object values in JCObject, which is to define a separate getter for each of those properties.

JoshuaCWebDeveloper commented 4 years ago

This behavior also causes problems when the object value is null (#19).

JoshuaCWebDeveloper commented 3 years ago

This also happens for Date objects.

JoshuaCWebDeveloper commented 3 years ago

We could add custom cloners for some common object types, and provide a way for the user to define custom cloning.