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

Function ensurePathIsNonModuleName

test/fixtures/snapshot/typescript.js:8040–8042  ·  view source on GitHub ↗

* Ensures a path is either absolute (prefixed with `/` or `c:`) or dot-relative (prefixed * with `./` or `../`) so as not to be confused with an unprefixed module name. * * ```ts * ensurePathIsNonModuleName("/path/to/file.ext") === "/path/to/file.ext" * ensurePathIsNonModule

(path)

Source from the content-addressed store, hash-verified

8038 * ```
8039 */
8040 function ensurePathIsNonModuleName(path) {
8041 return !pathIsAbsolute(path) && !pathIsRelative(path) ? "./" + path : path;
8042 }
8043 ts.ensurePathIsNonModuleName = ensurePathIsNonModuleName;
8044 function changeAnyExtension(path, ext, extensions, ignoreCase) {
8045 var pathext = extensions !== undefined && ignoreCase !== undefined ? getAnyExtensionFromPath(path, extensions, ignoreCase) : getAnyExtensionFromPath(path);

Callers 1

getRelativePathFromFileFunction · 0.85

Calls 2

pathIsAbsoluteFunction · 0.85
pathIsRelativeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…