Open amaramth opened 8 years ago
👍 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:
NSMainNibFile: null,
'NSMainNibFile~ipad': null,
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:
<key>NSMainNibFile</key>
<value>NSMainNibFile~ipad</value>
Expected output:
--no 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.