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

Function joinPaths

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

Source from the content-addressed store, hash-verified

856
857/** `/api` + `/users` → `/api/users`; `/api/` + `/` → `/api`. */
858export function joinPaths(prefix: string, path: string): string {
859 const a = prefix.replace(/\/+$/, '');
860 const b = path.replace(/^\/+/, '');
861 const joined = b ? `${a}/${b}` : a;
862 return joined === '' ? '/' : joined;
863}
864
865/**
866 * 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