(node: LayoutNode)
| 143 | * @returns True if the node is valid, false otherwise. |
| 144 | */ |
| 145 | export function validateNode(node: LayoutNode): boolean { |
| 146 | if (!node.children == !node.data) { |
| 147 | console.error("Either children or data must be defined for node, not both"); |
| 148 | return false; |
| 149 | } |
| 150 | |
| 151 | if (node.children?.length === 0) { |
| 152 | console.error("Node cannot define an empty array of children"); |
| 153 | return false; |
| 154 | } |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Recursively walk the layout tree starting at the specified node. Run the specified callbacks, if any. |
no outgoing calls
no test coverage detected