@sean_kenny/eu4-text-file-to-json-parser-js
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -40,2 +40,14 @@ import { valueOrNestedValueIsNestedValue, valueOrNestedValueIsNestedValueArray, valueOrNestedValueIsString, valueOrNestedValueIsStringArray } from "./value-or-nested-value.js"; | ||
} | ||
if (valueOrNestedValueIsNestedValue(valueToPush) | ||
&& Object.keys(valueToPush).length === 0 | ||
&& currentArrayValueForKey !== undefined | ||
&& valueOrNestedValueIsNestedValueArray(currentArrayValueForKey)) { | ||
return { | ||
...input.outputJSONData, | ||
[key]: [ | ||
...currentArrayValueForKey, | ||
valueToPush | ||
] | ||
}; | ||
} | ||
if (currentArrayValueForKey === undefined || (valueOrNestedValueIsNestedValue(currentArrayValueForKey) | ||
@@ -71,3 +83,3 @@ && Object.keys(currentArrayValueForKey).length === 0)) { | ||
[lowestValueKey]: [ | ||
...valueForLowestValueKey.slice(0, 1), | ||
...valueForLowestValueKey.slice(0, -1), | ||
writeValueToOutputJSONData({ | ||
@@ -74,0 +86,0 @@ outputJSONData: valueForLowestValueKey.at(-1) ?? {}, |
{ | ||
"name": "@sean_kenny/eu4-text-file-to-json-parser-js", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A library for reading text files in the format EU4 encodes it's game data in.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
15193
226