@xliic/preserving-json-yaml-parser
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -75,3 +75,3 @@ "use strict"; | ||
const stack = [container]; | ||
visit(root, "fakeroot", root, { | ||
visit(null, "fakeroot", root, { | ||
onObjectStart: (parent, key, value, location) => { | ||
@@ -107,2 +107,5 @@ if (location) { | ||
}); | ||
if (typeof stack[0].fakeroot !== "object") { | ||
return undefined; | ||
} | ||
const range = (_a = (0, preserve_1.getPreservedLocation)(stack[0], "fakeroot")) === null || _a === void 0 ? void 0 : _a.value; | ||
@@ -109,0 +112,0 @@ (0, preserve_1.setPreservedRootRange)(stack[0].fakeroot, range); |
@@ -14,3 +14,3 @@ "use strict"; | ||
const location = { value: { start: node.offset, end: node.offset + node.length } }; | ||
if (parent.type === "property") { | ||
if (parent && parent.type === "property") { | ||
const key = parent.children[0]; | ||
@@ -17,0 +17,0 @@ location.key = { start: key.offset, end: key.offset + key.length }; |
@@ -19,3 +19,3 @@ "use strict"; | ||
const location = { value: { start: node.startPosition, end: node.endPosition } }; | ||
if (parent.kind === yaml_language_server_parser_1.Kind.MAPPING) { | ||
if (parent && parent.kind === yaml_language_server_parser_1.Kind.MAPPING) { | ||
location.key = { start: parent.key.startPosition, end: parent.key.endPosition }; | ||
@@ -22,0 +22,0 @@ } |
{ | ||
"name": "@xliic/preserving-json-yaml-parser", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "YAML/JSON parser and serializer that preserves formatting of the original numerical values (i.e. 1.0 vs 1) and handles integers bigger than MAX_SAFE_INTEGER", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
86255
1313