@stoplight/yaml
Advanced tools
Comparing version 2.3.0 to 2.4.0
export * from './getJsonPathForPosition'; | ||
export * from './getLocationForJsonPath'; | ||
export * from './parse'; | ||
export * from './parseWithPointers'; | ||
export * from './safeStringify'; | ||
export * from './types'; |
@@ -6,4 +6,5 @@ "use strict"; | ||
tslib_1.__exportStar(require("./getLocationForJsonPath"), exports); | ||
tslib_1.__exportStar(require("./parse"), exports); | ||
tslib_1.__exportStar(require("./parseWithPointers"), exports); | ||
tslib_1.__exportStar(require("./safeStringify"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@stoplight/yaml", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Useful functions when working with YAML.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import { YAMLNode } from 'yaml-ast-parser'; | ||
export declare const parseWithPointers: <T>(value: string) => import("@stoplight/types").IParserResult<T, YAMLNode, number[]>; | ||
export declare const walkAST: (node: YAMLNode | null) => unknown; |
@@ -16,3 +16,3 @@ "use strict"; | ||
return parsed; | ||
parsed.data = walk(ast); | ||
parsed.data = exports.walkAST(ast); | ||
if (ast.errors) { | ||
@@ -23,3 +23,3 @@ parsed.diagnostics = transformErrors(ast.errors, lineMap); | ||
}; | ||
const walk = (node) => { | ||
exports.walkAST = (node) => { | ||
if (node) { | ||
@@ -30,3 +30,3 @@ switch (node.kind) { | ||
for (const mapping of node.mappings) { | ||
container[mapping.key.value] = walk(mapping.value); | ||
container[mapping.key.value] = exports.walkAST(mapping.value); | ||
} | ||
@@ -36,3 +36,3 @@ return container; | ||
case yaml_ast_parser_1.Kind.SEQ: | ||
return node.items.map(item => walk(item)); | ||
return node.items.map(item => exports.walkAST(item)); | ||
case yaml_ast_parser_1.Kind.SCALAR: | ||
@@ -44,3 +44,3 @@ return 'valueObject' in node ? node.valueObject : node.value; | ||
} | ||
return walk(node.value); | ||
return exports.walkAST(node.value); | ||
default: | ||
@@ -47,0 +47,0 @@ return null; |
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
43365
27
427