@stoplight/yaml
Advanced tools
Comparing version 3.6.0 to 3.7.0
@@ -10,1 +10,2 @@ export * from './buildJsonPath'; | ||
export * from './types'; | ||
export * from './trapAccess'; |
@@ -13,2 +13,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./types"), exports); | ||
tslib_1.__exportStar(require("./trapAccess"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@stoplight/yaml", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "Useful functions when working with YAML.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,2 +8,3 @@ "use strict"; | ||
const lineForPosition_1 = require("./lineForPosition"); | ||
const trapAccess_1 = require("./trapAccess"); | ||
const types_2 = require("./types"); | ||
@@ -35,3 +36,2 @@ const utils_1 = require("./utils"); | ||
}; | ||
const KEYS = Symbol('object_keys'); | ||
exports.walkAST = (node, options, lineMap, diagnostics) => { | ||
@@ -80,4 +80,4 @@ if (node) { | ||
} | ||
if (KEYS in container) { | ||
container[KEYS].push(KEYS); | ||
if (trapAccess_1.KEYS in container) { | ||
container[trapAccess_1.KEYS].push(trapAccess_1.KEYS); | ||
} | ||
@@ -167,3 +167,3 @@ return container; | ||
if (preserveKeyOrder) { | ||
reduced[KEYS].push(KEYS); | ||
reduced[trapAccess_1.KEYS].push(trapAccess_1.KEYS); | ||
} | ||
@@ -174,11 +174,6 @@ return reduced; | ||
}; | ||
const traps = { | ||
ownKeys(target) { | ||
return target[KEYS]; | ||
}, | ||
}; | ||
function createMapContainer(preserveKeyOrder) { | ||
if (preserveKeyOrder) { | ||
const container = new Proxy({}, traps); | ||
Reflect.defineProperty(container, KEYS, { | ||
const container = trapAccess_1.trapAccess({}); | ||
Reflect.defineProperty(container, trapAccess_1.KEYS, { | ||
value: [], | ||
@@ -191,5 +186,5 @@ }); | ||
function deleteKey(container, key) { | ||
const index = key in container ? container[KEYS].indexOf(key) : -1; | ||
const index = key in container ? container[trapAccess_1.KEYS].indexOf(key) : -1; | ||
if (index !== -1) { | ||
container[KEYS].splice(index, 1); | ||
container[trapAccess_1.KEYS].splice(index, 1); | ||
} | ||
@@ -199,7 +194,7 @@ } | ||
deleteKey(container, key); | ||
container[KEYS].unshift(key); | ||
container[trapAccess_1.KEYS].unshift(key); | ||
} | ||
function pushKey(container, key) { | ||
deleteKey(container, key); | ||
container[KEYS].push(key); | ||
container[trapAccess_1.KEYS].push(key); | ||
} | ||
@@ -206,0 +201,0 @@ function validateMappingKey(mapping, lineMap, diagnostics, yamlMode) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
64360
42
702