MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / cleanFunctionName

Function cleanFunctionName

example/tests/gm_xhr_test.js:313–328  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

311 }
312
313 function cleanFunctionName(fn) {
314 let s = String(fn).trim();
315
316 if (!s) return "<anonymous>";
317 if (s === "<anonymous>") return s;
318
319 return s
320 .replace(/^async\*/, "async ")
321 .replace(/^setTimeout handler\*/, "timer ")
322 .replace(/^promise callback\*/, "promise ")
323 .replace(/\["#-[^"]+"\]/g, "[userscript]")
324 .replace(/\/</g, " › ")
325 .replace(/>+/g, "")
326 .replace(/\s+/g, " ")
327 .trim() || "<anonymous>";
328 }
329
330 function cleanFileName(file, options) {
331 let s = String(file);

Callers 1

prettyStackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected