MCPcopy Index your code
hub / github.com/angular/angular-cli / joinUrlParts

Function joinUrlParts

packages/angular/ssr/src/utils/url.ts:97–124  ·  view source on GitHub ↗
(...parts: string[])

Source from the content-addressed store, hash-verified

95 * ```
96 */
97export function joinUrlParts(...parts: string[]): string {
98 const normalizedParts: string[] = [];
99
100 for (const part of parts) {
101 if (part === '') {
102 // Skip any empty parts
103 continue;
104 }
105
106 let start = 0;
107 let end = part.length;
108
109 // Use "Pointers" to avoid intermediate slices
110 while (start < end && part[start] === '/') {
111 start++;
112 }
113
114 while (end > start && part[end - 1] === '/') {
115 end--;
116 }
117
118 if (start < end) {
119 normalizedParts.push(part.slice(start, end));
120 }
121 }
122
123 return addLeadingSlash(normalizedParts.join('/'));
124}
125
126/**
127 * Strips `/index.html` from the end of a URL's path, if present.

Callers 10

url_spec.tsFile · 0.90
handleMethod · 0.90
constructSerializedUrlFunction · 0.90
traverseRoutesConfigFunction · 0.90
handleSSGRouteFunction · 0.90
resolveRedirectToFunction · 0.90
extractFunction · 0.90
buildPathWithParamsFunction · 0.85

Calls 2

addLeadingSlashFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected