Add cloneOf
or clone
method check in clone function to handle odd cloning situations
#8299
Labels
enhancement
This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
clone
function falls back tovalueOf
, leading to a situation wherevalueOf
may not give you the cloned value you seek.If the current behavior is a bug, please provide the steps to reproduce.
See mongoosejs/mongoose-double#7 for background on the issue that lead to this ticket.
What is the expected behavior?
valueOf
should return a clone but this is not always possible. Thus we need a method that we can seek and call to generate a proper cloneSuggest adding a
cloneOf
orclone
method (similar to what is done for SchemaTypes) so we can support this would be great.Per private email conversation with @vkarpov15
The text was updated successfully, but these errors were encountered: