( eq: (node: T) => boolean, tree: T )
| 105 | }; |
| 106 | |
| 107 | export const findNode = <T extends { id: string; childNodes: Array<T> }, R>( |
| 108 | eq: (node: T) => boolean, |
| 109 | tree: T |
| 110 | ): T | null => { |
| 111 | try { |
| 112 | return findNodeOrThrow(eq, tree); |
| 113 | } catch { |
| 114 | return null; |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | export const findParentNodeOrThrow = < |
| 119 | T extends { id: string; childNodes: Array<T> } |
nothing calls this directly
no test coverage detected