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

Function tanstackPath

src/resolution/frameworks/tanstack-router.ts:80–95  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

78 * Returns null for a path that names no address at all.
79 */
80export function tanstackPath(raw: string): string | null {
81 if (!raw.startsWith('/')) return null;
82 const segs: string[] = [];
83 for (const seg of raw.split('/')) {
84 if (seg.length === 0) continue;
85 if (seg.startsWith('_')) continue; // pathless layout
86 if (seg.startsWith('(') && seg.endsWith(')')) continue; // route group
87 const bare = seg.endsWith('_') ? seg.slice(0, -1) : seg;
88 if (bare === '$') {
89 segs.push(':splat*');
90 continue;
91 }
92 segs.push(bare.startsWith('$') ? ':' + bare.slice(1) : bare);
93 }
94 return '/' + segs.join('/');
95}
96
97/**
98 * True when the literal names a pathless layout rather than a page.

Callers 3

parseTanstackRoutesFunction · 0.85
tanstackDestinationFunction · 0.85

Calls 2

pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected