(text: string)
| 31 | // 缓存配置数据 |
| 32 | let configCache: { [key: string]: string[] } = {}; |
| 33 | let lastUpdateCheck = 0; |
| 34 | const UPDATE_INTERVAL = 5 * 60 * 1000; // 5分钟检查一次 |
| 35 | |
| 36 | const filterInput = (s: string): string => |
| 37 | (s || "") |
| 38 | .split("") |
| 39 | // .filter((c) => /[\w\- ]/u.test(c)) |
| 40 | .filter((c) => c.length) |
| 41 | .join(""); |
| 42 | |
| 43 | // 从本地缓存读取JSON数组 |
| 44 | function readJsonArray(file: string): string[] { |
| 45 | try { |
| 46 | const raw = fs.readFileSync(file, "utf-8"); |
| 47 | const data = JSON.parse(raw); |
| 48 | return Array.isArray(data) ? data : []; |
| 49 | } catch { |
no outgoing calls
no test coverage detected