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

Function getBaseFileName

test/fixtures/snapshot/typescript.js:7753–7765  ·  view source on GitHub ↗
(path, extensions, ignoreCase)

Source from the content-addressed store, hash-verified

7751 }
7752 ts.getDirectoryPath = getDirectoryPath;
7753 function getBaseFileName(path, extensions, ignoreCase) {
7754 path = normalizeSlashes(path);
7755 // if the path provided is itself the root, then it has not file name.
7756 var rootLength = getRootLength(path);
7757 if (rootLength === path.length)
7758 return "";
7759 // return the trailing portion of the path starting after the last (non-terminal) directory
7760 // separator but not including any trailing directory separator.
7761 path = removeTrailingDirectorySeparator(path);
7762 var name = path.slice(Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator) + 1));
7763 var extension = extensions !== undefined && ignoreCase !== undefined ? getAnyExtensionFromPath(name, extensions, ignoreCase) : undefined;
7764 return extension ? name.slice(0, name.length - extension.length) : name;
7765 }
7766 ts.getBaseFileName = getBaseFileName;
7767 function tryGetExtensionFromPath(path, extension, stringEqualityComparer) {
7768 if (!ts.startsWith(extension, "."))

Callers 2

hasExtensionFunction · 0.85
getAnyExtensionFromPathFunction · 0.85

Calls 6

normalizeSlashesFunction · 0.85
getRootLengthFunction · 0.85
getAnyExtensionFromPathFunction · 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…