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

Function normalizeRoot

src/ui-server/api/map.ts:217–223  ·  view source on GitHub ↗
(raw: string | undefined)

Source from the content-addressed store, hash-verified

215
216/** Strip a trailing slash and any leading `./`, so `src/` and `src` are one root. */
217export function normalizeRoot(raw: string | undefined): string {
218 let root = (raw ?? '').trim().replace(/\\/g, '/');
219 while (root.startsWith('./')) root = root.slice(2);
220 while (root.endsWith('/')) root = root.slice(0, -1);
221 if (root === '.' || root === '/') return '';
222 return root;
223}
224
225function stemOf(basename: string): string {
226 const dot = basename.indexOf('.');

Callers 2

ui-map-api.test.tsFile · 0.90
parseMapQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected