hypertune
Version:
[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt
28 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = getNodePath;
exports.getJsonNodePathAndArgs = getJsonNodePathAndArgs;
function getNodePath(parent, step) {
return `${parent ? `${getNodePath(parent.props.parent, parent.props.step)} > ` : ""}${!step
? "{}"
: step.type === "GetFieldStep"
? `${step.fieldName}(${JSON.stringify(step.fieldArguments)})`
: `[${step.index}]`}`;
}
function getJsonNodePathAndArgs(parent, step) {
const { path: basePath, args } = parent
? getJsonNodePathAndArgs(parent.props.parent, parent.props.step)
: { path: "", args: {} };
const path = `${basePath}${!step
? ""
: step.type === "GetFieldStep"
? `${basePath ? "." : ""}${step.fieldName}`
: `[${step.index}]`}`;
if (step &&
step.type === "GetFieldStep" &&
Object.keys(step.fieldArguments).length > 0) {
args[path] = step.fieldArguments;
}
return { path, args };
}
//# sourceMappingURL=getNodePath.js.map