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

Function routerCall

src/resolution/frameworks/react.ts:1111–1121  ·  view source on GitHub ↗
(at: number)

Source from the content-addressed store, hash-verified

1109 // `useRoutes(…)` / `createBrowserRouter(…)` hand the router a table; so does
1110 // `AppRoutes.map(…)` when its callback renders a `<Route>` from each item.
1111 const routerCall = (at: number): { map?: TableName } | null => {
1112 if (!options.uses) return null;
1113 let j = at - 1;
1114 while (j >= 0 && /\s/.test(source[j]!)) j--;
1115 if (source[j] !== 's' && source[j] !== 'r' && source[j] !== 'p') return null;
1116 const before = source.slice(Math.max(0, at - 64), at);
1117 if (/(?:^|[^\w$.])(?:useRoutes|create(?:Browser|Hash|Memory)Router)\s*$/.test(before)) return {};
1118 const map = /(?:^|[^\w$.])([A-Za-z_$][\w$]*)\s*\??\.\s*map\s*$/.exec(before);
1119 if (!map) return null;
1120 return { map: { name: map[1]!, call: false, at: at - before.length + map.index + map[0].indexOf(map[1]!) } };
1121 };
1122 const routesFromElements = (at: number): boolean => {
1123 let j = at - 1;
1124 while (j >= 0 && /\s/.test(source[j]!)) j--;

Callers 1

unitFunction · 0.85

Calls 1

execMethod · 0.65

Tested by

no test coverage detected