* Checks whether a node satisfies the provided query. * * @param node Node being evaluated. * @param query Predicate or property query description. * @returns True when the node matches.
(node: DesignNode, query: NodeQuery)
| 466 | * @returns True when the node matches. |
| 467 | */ |
| 468 | function matchNode(node: DesignNode, query: NodeQuery): boolean { |
| 469 | if (typeof query === 'function') return query(node) |
| 470 | |
| 471 | return ( |
| 472 | matchProperty(node.type, query.type) && |
| 473 | matchProperty(node.name, query.name) && |
| 474 | matchProperty(node.visible, query.visible ?? true) |
| 475 | ) |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Find the first direct child that matches the query. |
no test coverage detected