MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / nested

Function nested

src/resolution/frameworks/react.ts:2460–2463  ·  view source on GitHub ↗
(n: Node)

Source from the content-addressed store, hash-verified

2458
2459 // A hook nested inside another function is only callable in there.
2460 const nested = (n: Node): boolean =>
2461 context.getNodesInFile(n.filePath).some((f) =>
2462 f.id !== n.id && (f.kind === 'function' || f.kind === 'method') && f.startLine <= n.startLine && f.endLine >= n.endLine &&
2463 (f.startLine < n.startLine || f.endLine > n.endLine));
2464 const hooks = candidates.filter((n) => n.kind === 'function' && n.name.startsWith('use') && !nested(n));
2465 if (hooks.length === 0) return null;
2466 const sameFile = hooks.find((n) => n.filePath === fromFile);

Callers 1

resolveHookFunction · 0.85

Calls 1

getNodesInFileMethod · 0.65

Tested by

no test coverage detected