MCPcopy Create free account
hub / github.com/bytebase/bytebase / getGroupAtPath

Function getGroupAtPath

frontend/src/react/components/ExprEditor.tsx:140–153  ·  view source on GitHub ↗
(
  root: ConditionGroupExpr,
  path: Path
)

Source from the content-addressed store, hash-verified

138type Path = number[];
139
140function getGroupAtPath(
141 root: ConditionGroupExpr,
142 path: Path
143): ConditionGroupExpr {
144 let node: ConditionGroupExpr = root;
145 for (const idx of path) {
146 const child = node.args[idx];
147 if (!child || child.type !== ExprType.ConditionGroup) {
148 throw new Error("Invalid path");
149 }
150 node = child;
151 }
152 return node;
153}
154
155function useImmutableUpdate(groupPath: Path) {
156 const { root, onUpdate } = useExprEditorCtx();

Callers 1

useImmutableUpdateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected