Skip to content
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

Handling of null or undefined param in object.merge #262

Open
andi1984 opened this issue Dec 9, 2019 · 0 comments
Open

Handling of null or undefined param in object.merge #262

andi1984 opened this issue Dec 9, 2019 · 0 comments

Comments

@andi1984
Copy link

andi1984 commented Dec 9, 2019

Due to the while conditional in object.merge, there is a nasty edge-case which is about null or undefined in object.merge:

merge({}, null, {foo: 'bar'}) ==> {}
merge({}, {foo: 'bar'}, null) ==> {foo: 'bar'}

Which is counter-intuitive on how it is on Object.assign:

Object.assign({}, null, {foo: 'bar'}) ==> {foo: 'bar'}
Object.assign({}, {foo: 'bar'}, null) ==> {foo: 'bar'}

The same problems exist for undefined instead of null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant