Skip to content

Commit 4dc4f71

Browse files
authored
Merge pull request #94 from telime/master
Allowing empty string
2 parents e17373e + bd1094d commit 4dc4f71

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/parse.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ function parsePlistXML (node) {
129129
counter += 1;
130130
}
131131
if (counter % 2 === 1) {
132-
throw new Error('Missing value for "' + key + '" while parsing <dict/>');
132+
new_obj[key] = '';
133133
}
134+
134135
return new_obj;
135136

136137
} else if (node.nodeName === 'array') {

test/parse.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,10 @@ U=</data>
164164
parseFixture('<dict><key>a</key><key>b</key></dict>');
165165
});
166166
});
167-
168-
it('should throw if value is missing', function () {
169-
assert.throws(function () {
170-
parseFixture('<dict><key>a</key></dict>');
171-
});
167+
168+
it('should parse to empry string if value is missing', function () {
169+
var parsed = parseFixture('<dict><key>a</key></dict>');
170+
assert.deepEqual(parsed, { 'a': '' });
172171
});
173172

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

0 commit comments

Comments
 (0)