MCPcopy Create free account
hub / github.com/RobPruzan/react-scratch / findNode

Function findNode

src/utils.ts:107–116  ·  view source on GitHub ↗
(
  eq: (node: T) => boolean,
  tree: T
)

Source from the content-addressed store, hash-verified

105};
106
107export 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
118export const findParentNodeOrThrow = <
119 T extends { id: string; childNodes: Array<T> }

Callers

nothing calls this directly

Calls 1

findNodeOrThrowFunction · 0.85

Tested by

no test coverage detected