Skip to content

Commit

Permalink
Merge pull request #94 from telime/master
Browse files Browse the repository at this point in the history
Allowing empty string
  • Loading branch information
mreinstein authored Apr 26, 2022
2 parents e17373e + bd1094d commit 4dc4f71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ function parsePlistXML (node) {
counter += 1;
}
if (counter % 2 === 1) {
throw new Error('Missing value for "' + key + '" while parsing <dict/>');
new_obj[key] = '';
}

return new_obj;

} else if (node.nodeName === 'array') {
Expand Down
9 changes: 4 additions & 5 deletions test/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,10 @@ U=</data>
parseFixture('<dict><key>a</key><key>b</key></dict>');
});
});

it('should throw if value is missing', function () {
assert.throws(function () {
parseFixture('<dict><key>a</key></dict>');
});

it('should parse to empry string if value is missing', function () {
var parsed = parseFixture('<dict><key>a</key></dict>');
assert.deepEqual(parsed, { 'a': '' });
});

it('should parse an empty key', function () {
Expand Down

0 comments on commit 4dc4f71

Please sign in to comment.