(raw: string)
| 49 | * and lowercase. Returns null if the result is empty or has invalid chars. |
| 50 | */ |
| 51 | export function normalizeShortcode(raw: string): string | null { |
| 52 | const stripped = raw.trim().replace(/^:+/, "").replace(/:+$/, ""); |
| 53 | const lower = stripped.toLowerCase(); |
| 54 | return SHORTCODE_RE.test(lower) ? lower : null; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Suggest a valid custom-emoji shortcode from an uploaded filename. |
no outgoing calls
no test coverage detected