objects can now define how they are cloned by using a method with a symbol provided from this package
fixed bug where AggregateErrors were cloned as if the constructor API was the same as the other Error classes
constructors for various native classes are acquired without the usage of the constructor property, which avoids bugs where the user provides an object which is a native class instance with an overridden constructor property
cloneDeep and cloneDeepFully can be typed with generics now to indicate the input and output variables (the output is by default the same as the input, be we allow a second generic to the represent the return type since customizer and clone method usage can result in clones that are different types from the original)
Internally, the algorithm call methods on the prototypes for native classes, combined with call, to determine the type of something whenever possible. This is a stronger type-check that Object.prototype.toString.call since the latter can be easily broken with Symbol.toStringTag usage, while breaking the prototype approach requires monkeypatching fundamental JavaScript prototypes (a much greater offense). The only supported types for which this does not work are the TypeArray subclasses, in which case Object.prototype.toString.call is used to differentiate them.
fixed bug where some properties on native class instances were not recursed on, meaning they would not be cloned propertly if reassigned to any non-primitive
some exported types have been updated to reflect the changes.
various documentation improvements to README and docstrings
This new version includes:
constructor
property, which avoids bugs where the user provides an object which is a native class instance with an overriddenconstructor
propertycall
, to determine the type of something whenever possible. This is a stronger type-check that Object.prototype.toString.call since the latter can be easily broken with Symbol.toStringTag usage, while breaking the prototype approach requires monkeypatching fundamental JavaScript prototypes (a much greater offense). The only supported types for which this does not work are the TypeArray subclasses, in which case Object.prototype.toString.call is used to differentiate them.