(node: Node | null, until: (n: Node) => boolean)
| 888 | * get the closest node that satisfies the condition |
| 889 | */ |
| 890 | export const getClosestNode = (node: Node | null, until: (n: Node) => boolean): Node | undefined => { |
| 891 | if (!node) { |
| 892 | return undefined |
| 893 | } |
| 894 | if (until(node)) { |
| 895 | return node |
| 896 | } else { |
| 897 | return getClosestNode(node.parent, until) |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | /** |
| 902 | * get the closest clickable node |
no outgoing calls
no test coverage detected