MCPcopy
hub / github.com/QwikDev/qwik / normalize

Function normalize

packages/qwik/src/optimizer/src/path.ts:170–194  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

168 };
169
170 const normalize = function normalize(path: string) {
171 assertPath(path);
172
173 if (path.length === 0) {
174 return '.';
175 }
176
177 const isAbsolute = path.charCodeAt(0) === 47; /*/*/
178 const trailingSeparator = path.charCodeAt(path.length - 1) === 47; /*/*/
179
180 // Normalize the path
181 path = normalizeStringPosix(path, !isAbsolute);
182
183 if (path.length === 0 && !isAbsolute) {
184 path = '.';
185 }
186 if (path.length > 0 && trailingSeparator) {
187 path += '/';
188 }
189
190 if (isAbsolute) {
191 return '/' + path;
192 }
193 return path;
194 };
195
196 const isAbsolute = function isAbsolute(path: string) {
197 assertPath(path);

Callers 3

normalizePathFunction · 0.85
joinFunction · 0.85
normalizePathFunction · 0.85

Calls 2

assertPathFunction · 0.85
normalizeStringPosixFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…