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

Function getRelativePath

lib/internal/debugger/inspect_repl.js:131–142  ·  view source on GitHub ↗
(filenameOrURL)

Source from the content-addressed store, hash-verified

129}
130
131function getRelativePath(filenameOrURL) {
132 const dir = StringPrototypeSlice(Path.join(Path.resolve(), 'x'), 0, -1);
133
134 const filename = StringPrototypeStartsWith(filenameOrURL, 'file://') ?
135 fileURLToPath(filenameOrURL) : filenameOrURL;
136
137 // Change path to relative, if possible
138 if (StringPrototypeStartsWith(filename, dir)) {
139 return StringPrototypeSlice(filename, dir.length);
140 }
141 return filename;
142}
143
144// Adds spaces and prefix to number
145// maxN is a maximum number we should have space for

Callers 4

formatScriptsFunction · 0.70
[customInspectSymbol]Method · 0.70
formatLocationFunction · 0.70
createReplFunction · 0.70

Calls 3

fileURLToPathFunction · 0.85
joinMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…