MCPcopy Create free account
hub / github.com/block/buzz / normalizeShortcode

Function normalizeShortcode

desktop/src/shared/api/customEmoji.ts:51–55  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

49 * and lowercase. Returns null if the result is empty or has invalid chars.
50 */
51export 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.

Callers 6

CustomEmojiSettingsCardFunction · 0.90
customEmojiFromTagsFunction · 0.85
setCustomEmojiFunction · 0.85
removeCustomEmojiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected