-
Notifications
You must be signed in to change notification settings - Fork 7.1k
When merging modified primitive type objects, added properties get dropped #2008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is a lodash wide behavior. When cloning or comparing boolean, number, & string objects any added properties are ignored. The use of those is so rare that I could see putting them down the plain object path. |
This behavior seemed to change from 4.3 to 4.4, why might that have changed between minor versions? |
Our clone/equality behavior did not change between 4.3 and 4.4. We did fix an issue where we weren't cloning a value properly which may be what you're seeing. Lodash has never supported expando properties on the object form of primitives. I'll add support for it though. It'll slow those paths down but they aren't used nearly as often as arrays and plain objects so it's cool. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug when using v4.4.0
We use a pattern where we add properties to a string object. When we try to merge that string property into another object, all the properties originally added are dropped.
I'm not sure if this is specifically an issue with merge, or if other functions are affected.
The text was updated successfully, but these errors were encountered: