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

Function lazyScriptName

src/pkg/config/config.ts:528–538  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

526
527// 新腳本自動改名
528export const lazyScriptName = (code: string) => {
529 if (!lazyScriptNamePrefix) {
530 // 使用執行時的亂數種子
531 // prefix 為 A000 ~ ZZZZ
532 lazyScriptNamePrefix = (((Math.random() * (1679615 - 466560 + 1)) | 0) + 466560).toString(36).toUpperCase();
533 }
534 code = code.replace(/@name\s+(New Userscript)[\r\n]/g, (s, name) => {
535 return s.replace(name, `${name} ${lazyScriptNamePrefix}-${++lazyScriptIndex}`);
536 });
537 return code;
538};

Callers 1

emptyScriptFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected