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

Function joinPaths

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

Source from the content-addressed store, hash-verified

619
620/** `/api` + `/users` → `/api/users`; `/api/` + `/` → `/api`. */
621export function joinPaths(prefix: string, path: string): string {
622 const a = prefix.replace(/\/+$/, '');
623 const b = path.replace(/^\/+/, '');
624 const joined = b ? `${a}/${b}` : a;
625 return joined === '' ? '/' : joined;
626}
627
628/**
629 * 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