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

Function getDirectoryPath

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

Source from the content-addressed store, hash-verified

7739 }
7740 ts.getRootLength = getRootLength;
7741 function getDirectoryPath(path) {
7742 path = normalizeSlashes(path);
7743 // If the path provided is itself the root, then return it.
7744 var rootLength = getRootLength(path);
7745 if (rootLength === path.length)
7746 return path;
7747 // return the leading portion of the path up to the last (non-terminal) directory separator
7748 // but not including any trailing directory separator.
7749 path = removeTrailingDirectorySeparator(path);
7750 return path.slice(0, Math.max(rootLength, path.lastIndexOf(ts.directorySeparator)));
7751 }
7752 ts.getDirectoryPath = getDirectoryPath;
7753 function getBaseFileName(path, extensions, ignoreCase) {
7754 path = normalizeSlashes(path);

Callers 2

getRelativePathFromFileFunction · 0.85
forEachAncestorDirectoryFunction · 0.85

Calls 5

normalizeSlashesFunction · 0.85
getRootLengthFunction · 0.85
sliceMethod · 0.65
maxMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…