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

Function isRelative

lib/internal/modules/cjs/loader.js:2178–2186  ·  view source on GitHub ↗

* Checks if a path is relative * @param {string} path the target path * @returns {boolean} true if the path is relative, false otherwise

(path)

Source from the content-addressed store, hash-verified

2176 * @returns {boolean} true if the path is relative, false otherwise
2177 */
2178function isRelative(path) {
2179 if (StringPrototypeCharCodeAt(path, 0) !== CHAR_DOT) { return false; }
2180
2181 return path.length === 1 || path === '..' ||
2182 StringPrototypeStartsWith(path, './') ||
2183 StringPrototypeStartsWith(path, '../') ||
2184 ((isWindows && StringPrototypeStartsWith(path, '.\\')) ||
2185 StringPrototypeStartsWith(path, '..\\'));
2186}
2187
2188Module.createRequire = createRequire;
2189

Callers 1

loader.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…