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

Function tanstackPath

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

Source from the content-addressed store, hash-verified

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