@xliic/preserving-json-yaml-parser
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -1,1 +0,2 @@ | ||
export declare function simpleClone<T>(orig: T, replacer?: (value: unknown) => unknown): T; | ||
import { Path } from "./types"; | ||
export declare function simpleClone<T>(orig: T, replacer?: (value: unknown, location: Path) => unknown): T; |
@@ -12,5 +12,7 @@ "use strict"; | ||
let container = {}; | ||
let location = []; | ||
const stack = [container]; | ||
(0, object_1.visitObject)(undefined, "fakeroot", orig, { | ||
onObjectStart: (parent, key, value) => { | ||
location.push(key); | ||
stack.push(container); | ||
@@ -21,5 +23,7 @@ container = container[key] = {}; | ||
onObjectEnd: () => { | ||
location.pop(); | ||
container = stack.pop(); | ||
}, | ||
onArrayStart: (parent, key, value) => { | ||
location.push(key); | ||
stack.push(container); | ||
@@ -30,6 +34,7 @@ container = container[key] = []; | ||
onArrayEnd: () => { | ||
location.pop(); | ||
container = stack.pop(); | ||
}, | ||
onValue: (parent, key, value, preserved) => { | ||
container[key] = replacer ? replacer(value) : value; | ||
container[key] = replacer ? replacer(value, [...location.slice(1), key]) : value; | ||
}, | ||
@@ -36,0 +41,0 @@ }); |
{ | ||
"name": "@xliic/preserving-json-yaml-parser", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"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", | ||
@@ -21,12 +21,12 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^27.5.1", | ||
"@types/jest": "^29.5.6", | ||
"@types/js-yaml": "^4.0.2", | ||
"@types/node": "^14.14.31", | ||
"jest": "^28.1.0", | ||
"jest": "^29.7.0", | ||
"js-yaml": "^4.1.0", | ||
"jsonc-parser": "^3.0.0", | ||
"outdent": "^0.8.0", | ||
"ts-jest": "^28.0.3", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^4.7.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88260
1353