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

Function joinPaths

src/resolution/frameworks/express.ts:607–612  ·  view source on GitHub ↗

`/api` + `/users` → `/api/users`; `/api/` + `/` → `/api`.

(prefix: string, path: string)

Source from the content-addressed store, hash-verified

605
606/** `/api` + `/users` → `/api/users`; `/api/` + `/` → `/api`. */
607function joinPaths(prefix: string, path: string): string {
608 const a = prefix.replace(/\/+$/, '');
609 const b = path.replace(/^\/+/, '');
610 const joined = b ? `${a}/${b}` : a;
611 return joined === '' ? '/' : joined;
612}
613
614/**
615 * The file a mount's last argument names: an inline `require('./x')`, an

Callers 1

postExtractFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected