clickable-json
Version:
Interactive JSON and JSON CRDT viewer and editor
27 lines • 677 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.nodeRef = exports.NodeRef = void 0;
class NodeRef {
constructor(node, parent, step) {
this.node = node;
this.parent = parent;
this.step = step;
}
}
exports.NodeRef = NodeRef;
const map = new WeakMap();
const nodeRef = (node, parent, step) => {
try {
const ref = map.get(node);
if (ref)
return ref;
const newRef = new NodeRef(node, parent, step);
map.set(node, newRef);
return newRef;
}
catch (_a) {
return undefined;
}
};
exports.nodeRef = nodeRef;
//# sourceMappingURL=NodeRef.js.map
;