'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.fieldPathToSchema = exports.schemaPointerToFieldPath = exports.fieldPathToSchemaPath = undefined; var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var fieldPathToSchemaPath = exports.fieldPathToSchemaPath = function fieldPathToSchemaPath(fieldPath) { var newPath = _lodash2.default.zip(_lodash2.default.fill(fieldPath.split('.'), 'properties'), fieldPath.split('.')); return _lodash2.default.flatten(newPath).join('.'); }; // Assumption: used only for jsonPointer returned from traverse var schemaPointerToFieldPath = exports.schemaPointerToFieldPath = function schemaPointerToFieldPath(jsonPointer) { return jsonPointer.split('/').slice(2).filter(function (e) { return e !== 'properties'; }).join('.'); }; var fieldPathToSchema = exports.fieldPathToSchema = function fieldPathToSchema(schema, fieldPath) { return _lodash2.default.get(schema, fieldPathToSchemaPath(fieldPath)); };