UNPKG

@microsoft.azure/openapi-validator-core

Version:
21 lines 751 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stringify = exports.nodes = void 0; const tslib_1 = require("tslib"); const JSONPath = tslib_1.__importStar(require("jsonpath-plus")); function nodes(obj, pathExpression) { try { const result = JSONPath.JSONPath({ json: obj, path: pathExpression, resultType: "all" }); return result.map((v) => ({ path: JSONPath.JSONPath.toPathArray(v.path), value: v.value, parent: v.parent })); } catch (e) { return []; } } exports.nodes = nodes; function stringify(path) { const pathWithRoot = ["$", ...path]; return JSONPath.JSONPath.toPathString(pathWithRoot); } exports.stringify = stringify; //# sourceMappingURL=jsonpath.js.map