(node: LayoutNode, id: string)
| 111 | * @returns The node with the given id or undefined if no node with the given id was found. |
| 112 | */ |
| 113 | export function findNode(node: LayoutNode, id: string): LayoutNode | undefined { |
| 114 | if (!node) return; |
| 115 | if (node.id === id) return node; |
| 116 | if (!node.children) return; |
| 117 | for (const child of node.children) { |
| 118 | const result = findNode(child, id); |
| 119 | if (result) return result; |
| 120 | } |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * Finds the node whose children contains the node with the given id. |
no outgoing calls
no test coverage detected