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

Method getShortestUniqueName

deps/v8/tools/profile.mjs:156–172  ·  view source on GitHub ↗
(url, script)

Source from the content-addressed store, hash-verified

154 }
155
156 static getShortestUniqueName(url, script) {
157 const parts = url.split('/');
158 const filename = parts[parts.length -1];
159 const dict = this._dict ?? (this._dict = new Map());
160 const matchingScripts = dict.get(filename);
161 if (matchingScripts == undefined) {
162 dict.set(filename, [script]);
163 return filename;
164 }
165 // TODO: find shortest unique substring
166 // Update all matching scripts to have a unique filename again.
167 for (let matchingScript of matchingScripts) {
168 matchingScript.name = script.url
169 }
170 matchingScripts.push(script);
171 return url;
172 }
173
174 ensureSourceMapCalculated(sourceMapFetchPrefix=undefined) {
175 if (this._sourceMapState !== "unknown") return;

Callers 1

updateMethod · 0.80

Calls 4

getMethod · 0.65
splitMethod · 0.45
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected