@baqhub/sdk
Version:
The official JavaScript SDK for the BAQ federated app platform.
15 lines (14 loc) • 617 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizePath = normalizePath;
const tslib_1 = require("tslib");
const jsonpath_plus_1 = require("jsonpath-plus");
const snakeCase_js_1 = tslib_1.__importDefault(require("lodash/snakeCase.js"));
function normalizePath(path) {
function mapPathElement(element) {
const transformed = (0, snakeCase_js_1.default)(element);
return transformed || element;
}
const pathArray = jsonpath_plus_1.JSONPath.toPathArray(`$.${path}`).map(mapPathElement);
return jsonpath_plus_1.JSONPath.toPathString(pathArray);
}