1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | const fill_1 = __importDefault(require("lodash/fill"));
|
7 | const flatten_1 = __importDefault(require("lodash/flatten"));
|
8 | const get_1 = __importDefault(require("lodash/get"));
|
9 | const zip_1 = __importDefault(require("lodash/zip"));
|
10 | exports.fieldPathToSchemaPath = (fieldPath) => {
|
11 | let newPath = zip_1.default(fill_1.default(fieldPath.split('.'), 'properties'), fieldPath.split('.'));
|
12 | return flatten_1.default(newPath).join('.');
|
13 | };
|
14 |
|
15 | exports.schemaPointerToFieldPath = (jsonPointer) => {
|
16 | return jsonPointer
|
17 | .split('/')
|
18 | .slice(2)
|
19 | .filter(e => e !== 'properties')
|
20 | .join('.');
|
21 | };
|
22 | exports.fieldPathToSchema = (schema, fieldPath) => {
|
23 | return get_1.default(schema, exports.fieldPathToSchemaPath(fieldPath));
|
24 | };
|
25 |
|
\ | No newline at end of file |