-
Notifications
You must be signed in to change notification settings - Fork 123
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
simple bug: Inconsistencies around null and undefined #75
Comments
👍 PR welcome |
technically this would be an API change, so if you send a PR this would require bumping the major version on publish. Just putting this here as a reminder if/when that happens. |
This i causing exactly the issue a-lot of Cordova users currently have: Here is an example: Cordova adds two keys with nullified values to plist, which plist reads them out:
What plist (latest) is then doing is, it writes them back to plist (including all others possible options we write to config.xml). The objects above become:
Expected output:
One option currently is to use the version 1.2.0 (yea, 1.2.0!) or, the hacky way to just remove both keys from plist "manually" from the string that plist module generates. Both of them are totally wrong. |
@amaramth I know this is a crazy-late reply, but I'm getting ready to start tackling a v4 of plist.js. If you're still interested in having this change go into a new major version, it's upcoming. |
In code,
plist.build({foo:undefined}) === plist.build({})
andplist.build({foo:null}) === plist.build(plist.parse(plist.build({foo:null})))
are not true and I think they should be.exposition:
Javascript has
null
andundefined
and [key missing]; JSON hasnull
and [key missing]; plist has [key has no value] and [key missing]. I derive this fromplist.build({foo:null}) !== plist.build({})
, which is true and seems like it should be - this assumption might be false, though.JSON.stringify,parse
convertsnull
↔ jsonnull
undefined
→ json [key missing]plist.build,parse
should do likewise, convertingnull
↔ plist [key has no value]undefined
→ plist [key missing].Currently, it actually does
null
,undefined
→ plist [key has no value]Can you reply with clarification? I don't know if that's the most consistent way to change this, or if it should be changed.
The text was updated successfully, but these errors were encountered: