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

Setting a null value should convert it to object #37

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

slavivanov
Copy link
Contributor

Setting a null value should convert it to object (like it works for undefined values).

@mickhansen
Copy link
Owner

Personally I wouldn't lump in null with undefined as null can be explicitly set and have a semantic meaning.
Is using the force: true option to always override not sufficient in this case?

@slavivanov
Copy link
Contributor Author

No, hasOwnProp.call(current, piece) fails with TypeError: Cannot convert undefined or null to object .
It should be possible to overwrite null with force: true only, but I don't think it should fail on null anyway.

@slavivanov
Copy link
Contributor Author

Appended it to throw on overwriting null with force: false, and to overwrite null with force: true.

@mickhansen mickhansen merged commit dbf26a6 into mickhansen:master Feb 7, 2023
@mickhansen
Copy link
Owner

Awesome, thank you @slavivanov

@mickhansen
Copy link
Owner

Published in v2.0.3

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

Successfully merging this pull request may close these issues.

2 participants