-
Notifications
You must be signed in to change notification settings - Fork 217
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
Fix merging with empty values #185
base: master
Are you sure you want to change the base?
Conversation
This is way too specialized/specific. It's fine as a fork to use in a specific project, but isn't a good feature for a broadly-used utility. I am open to changing the |
@TehShrike I need this too! So I basically want to merge only when the new object has a value (avoiding nulls overriding). Something like here: https://www.rubydoc.info/gems/deep_merge/1.2.1
This does not seem to be possible to do using
This would not break existing behavior but would allow to turn it off. |
I have the same use case to ignore empty strings when merging. I think it would make sense to extend the signature of customMerge to provide values, so this and similar use cases could easily be solved. This would make this package a lot more flexible, in my opinion. |
I would love to have this as well. |
+1 To the modification to customMerge signature. Allows users to implement multiple edge cases. |
+1 here need some way of handling this |
My previous comment stands – I'm open to PRs to make the necessary changes to |
… or empty string overwrites
… or empty string overwrites + a sweet little util function customMergeIgnoreEmptyValues for cuteness
… or empty string overwrites + a sweet little util function customMergeIgnoreEmptyValues for cuteness
Adds isEmpty option. Then the following code
gives you