MCPcopy Index your code
hub / github.com/nodejs/node / normalizePath

Function normalizePath

test/fixtures/snapshot/typescript.js:7980–7997  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

7978 }
7979 ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath;
7980 function normalizePath(path) {
7981 path = normalizeSlashes(path);
7982 // Most paths don't require normalization
7983 if (!relativePathSegmentRegExp.test(path)) {
7984 return path;
7985 }
7986 // Some paths only require cleanup of `/./` or leading `./`
7987 var simplified = path.replace(/\/\.\//g, "/").replace(/^\.\//, "");
7988 if (simplified !== path) {
7989 path = simplified;
7990 if (!relativePathSegmentRegExp.test(path)) {
7991 return path;
7992 }
7993 }
7994 // Other paths require full normalization
7995 var normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path)));
7996 return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
7997 }
7998 ts.normalizePath = normalizePath;
7999 function getPathWithoutRoot(pathComponents) {
8000 if (pathComponents.length === 0)

Callers 2

resolvePathFunction · 0.70
toPathFunction · 0.70

Calls 7

normalizeSlashesFunction · 0.85
reducePathComponentsFunction · 0.85
getPathComponentsFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…