Skip to content
This repository was archived by the owner on Apr 5, 2026. It is now read-only.

Setting a null value should convert it to object#37

Merged
mickhansen merged 2 commits intomickhansen:masterfrom
slavivanov:master
Feb 7, 2023
Merged

Setting a null value should convert it to object#37
mickhansen merged 2 commits intomickhansen:masterfrom
slavivanov:master

Conversation

@slavivanov
Copy link
Copy Markdown
Contributor

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

@mickhansen
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Owner

Awesome, thank you @slavivanov

@mickhansen
Copy link
Copy Markdown
Owner

Published in v2.0.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants