@ea-lab/reactive-json
Version:
A REACT-based lib that transforms JSON (or YAML) into interactive HTML markup.
30 lines (29 loc) • 690 B
JavaScript
import { dataLocationToPath as s } from "../../engine/TemplateSystem.js";
const d = (a) => {
const { globalDataContext: e, templateContext: r } = a, { path: n, target: i } = a.args;
if (n === void 0 && i !== "currentTemplateData")
return;
let t;
if (n)
t = s({
currentPath: r.templatePath,
dataLocation: n,
globalDataContext: e,
templateContext: r
});
else {
t = r.templatePath;
let o = a.args.parentLevel ?? 0;
for (; o > 0; ) {
--o;
const l = t.lastIndexOf(".");
if (l < 1)
return;
t = t.substring(0, l);
}
}
e == null || e.updateData(void 0, t, "remove");
};
export {
d as removeData
};