( root: ConditionGroupExpr, path: Path )
| 138 | type Path = number[]; |
| 139 | |
| 140 | function 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 | |
| 155 | function useImmutableUpdate(groupPath: Path) { |
| 156 | const { root, onUpdate } = useExprEditorCtx(); |
no outgoing calls
no test coverage detected