From 42de4de404f2d259a895f3d5f8f4142316c6d3f1 Mon Sep 17 00:00:00 2001 From: telime Date: Thu, 24 Jan 2019 21:24:11 +0900 Subject: [PATCH 1/5] Allowing empty objects --- lib/parse.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/parse.js b/lib/parse.js index 76f7cf6..921624b 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -125,12 +125,11 @@ function parsePlistXML (node) { + '" while parsing .' ); new_obj[key] = parsePlistXML(node.childNodes[i]); + key = null; } counter += 1; } - if (counter % 2 === 1) { - throw new Error('Missing value for "' + key + '" while parsing '); - } + return new_obj; } else if (node.nodeName === 'array') { From f44bebae76d1fae830dd74c35a5f0980fdced625 Mon Sep 17 00:00:00 2001 From: telime Date: Mon, 11 Feb 2019 19:14:55 +0900 Subject: [PATCH 2/5] Minimize changes --- lib/parse.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/parse.js b/lib/parse.js index 921624b..b204cda 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -127,6 +127,9 @@ function parsePlistXML (node) { new_obj[key] = parsePlistXML(node.childNodes[i]); key = null; } + if (counter % 2 === 1) { + new_obj[key] = ''; + } counter += 1; } From 9c8523c9370719d56ed172e4a16727aaec54341f Mon Sep 17 00:00:00 2001 From: telime Date: Mon, 11 Feb 2019 19:15:07 +0900 Subject: [PATCH 3/5] Minimize changes --- lib/parse.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/parse.js b/lib/parse.js index b204cda..4928021 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -125,7 +125,6 @@ function parsePlistXML (node) { + '" while parsing .' ); new_obj[key] = parsePlistXML(node.childNodes[i]); - key = null; } if (counter % 2 === 1) { new_obj[key] = ''; From 3afb8404e41d45e70f9d739646ad5fa270978574 Mon Sep 17 00:00:00 2001 From: telime Date: Mon, 11 Feb 2019 19:21:17 +0900 Subject: [PATCH 4/5] Fix mistake --- lib/parse.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/parse.js b/lib/parse.js index 4928021..1e7fe5a 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -126,11 +126,11 @@ function parsePlistXML (node) { ); new_obj[key] = parsePlistXML(node.childNodes[i]); } - if (counter % 2 === 1) { - new_obj[key] = ''; - } counter += 1; } + if (counter % 2 === 1) { + new_obj[key] = ''; + } return new_obj; From bd1094d1e3298af6b9a51b1e66c3c930fe26f5ee Mon Sep 17 00:00:00 2001 From: hiroro Date: Wed, 27 Apr 2022 03:44:00 +0900 Subject: [PATCH 5/5] Change Test code for unity plist --- test/parse.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/parse.js b/test/parse.js index 0dd10ba..01b785f 100644 --- a/test/parse.js +++ b/test/parse.js @@ -157,11 +157,10 @@ U= parseFixture('ab'); }); }); - - it('should throw if value is missing', function () { - assert.throws(function () { - parseFixture('a'); - }); + + it('should parse to empry string if value is missing', function () { + var parsed = parseFixture('a'); + assert.deepEqual(parsed, { 'a': '' }); }); it('should parse an empty key', function () {