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

Function joinPaths

src/resolution/frameworks/express.ts:622–627  ·  view source on GitHub ↗
(prefix: string, path: string)

Source from the content-addressed store, hash-verified

620
621/** `/api` + `/users` → `/api/users`; `/api/` + `/` → `/api`. */
622export function joinPaths(prefix: string, path: string): string {
623 const a = prefix.replace(/\/+$/, '');
624 const b = path.replace(/^\/+/, '');
625 const joined = b ? `${a}/${b}` : a;
626 return joined === '' ? '/' : joined;
627}
628
629/**
630 * The file a mount's last argument names: an inline `require('./x')`, an

Callers 2

joinRouteFunction · 0.90
postExtractFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected