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

Function destinationsForHref

src/resolution/frameworks/nextjs.ts:188–202  ·  view source on GitHub ↗
(href: HrefLiteral, table: RouteTable)

Source from the content-addressed store, hash-verified

186 * names a path it did not take.
187 */
188export function destinationsForHref(href: HrefLiteral, table: RouteTable): HrefDestination[] {
189 const out: HrefDestination[] = [];
190 const seen = new Set<string>();
191 for (const arm of hrefArms(href)) {
192 const segs = hrefSegments(arm);
193 if (segs === null) continue;
194 const target = matchRoute(segs, table);
195 // An arm naming no route drops out; the arms that DO name one are still
196 // places this navigation goes.
197 if (!target || seen.has(target.id)) continue;
198 seen.add(target.id);
199 out.push({ node: target, href: arm });
200 }
201 return out;
202}
203
204/** The single route an href names, or null when it names none. The first arm wins a fork. */
205export function pageForHref(href: HrefLiteral, table: RouteTable): Node | null {

Callers 13

angularTemplateEdgesFunction · 0.90
svelteKitLinkEdgesFunction · 0.90
reactRouterLinkEdgesFunction · 0.90
tanstackLinkEdgesFunction · 0.90
vueRouterLinkEdgesFunction · 0.90
nextLinkEdgesFunction · 0.90
resolveFunction · 0.90
resolveFunction · 0.90
resolveFunction · 0.90
resolveFunction · 0.90
resolveFunction · 0.90
pageForHrefFunction · 0.85

Calls 6

hrefArmsFunction · 0.90
matchRouteFunction · 0.90
hrefSegmentsFunction · 0.85
hasMethod · 0.80
pushMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected