(str)
| 6 | |
| 7 | // ─── HTML 转义 ────────────────────────────────────────────── |
| 8 | export function htmlspecialchars(str) { |
| 9 | return str |
| 10 | .replace(/&/g, '&') |
| 11 | .replace(/</g, '<') |
| 12 | .replace(/>/g, '>') |
| 13 | .replace(/"/g, '"') |
| 14 | .replace(/'/g, '''); |
| 15 | } |
| 16 | |
| 17 | // ─── URL 检测 ─────────────────────────────────────────────── |
| 18 | export function isUrl(str) { |
no outgoing calls
no test coverage detected