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

Function normalizePath

packages/qwik/src/testing/util.ts:9–26  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

7}
8
9export function normalizePath(path: string) {
10 path = normalize(path);
11
12 // MIT https://github.com/sindresorhus/slash/blob/main/license
13 // Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar
14 const isExtendedLengthPath = /^\\\\\?\\/.test(path);
15 const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
16
17 if (isExtendedLengthPath || hasNonAscii) {
18 return path;
19 }
20
21 path = path.replace(/\\/g, '/');
22 if (path.endsWith('/')) {
23 path = path.slice(0, path.length - 1);
24 }
25 return path;
26}
27
28/**
29 * Walks the object graph and replaces any DOM Nodes with their string representation.

Callers 3

rollup.unit.tsFile · 0.90
plugin.unit.tsFile · 0.90
vite.unit.tsFile · 0.90

Calls 1

normalizeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…