MCPcopy
hub / github.com/vitejs/vite / joinUrlSegments

Function joinUrlSegments

packages/vite/src/node/utils.ts:1642–1653  ·  view source on GitHub ↗
(a: string, b: string)

Source from the content-addressed store, hash-verified

1640}
1641
1642export function joinUrlSegments(a: string, b: string): string {
1643 if (!a || !b) {
1644 return a || b || ''
1645 }
1646 if (a.endsWith('/')) {
1647 a = a.substring(0, a.length - 1)
1648 }
1649 if (b[0] !== '/') {
1650 b = '/' + b
1651 }
1652 return a + b
1653}
1654
1655export function removeLeadingSlash(str: string): string {
1656 return str[0] === '/' ? str.slice(1) : str

Callers 11

toOutputFilePathInJSFunction · 0.90
generateBundleFunction · 0.90
addDepsFunction · 0.90
baseMiddlewareFunction · 0.90
devHtmlHookFunction · 0.90
htmlFallbackMiddlewareFunction · 0.90
fileToDevUrlFunction · 0.90
publicFileToBuiltUrlFunction · 0.90
normalizeUrlFunction · 0.90
urlResolverFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected