Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit cc40dd7

Browse files
committed
Move some code around for clarity
Signed-off-by: Robin Townsend <[email protected]>
1 parent bd80201 commit cc40dd7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/emoji.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ export const DATA_BY_CATEGORY = {
6161

6262
// Store various mappings from unicode/emoticon/shortcode to the Emoji objects
6363
export const EMOJI: IEmoji[] = EMOJIBASE.map((emojiData: Omit<IEmoji, "shortcodes">) => {
64-
const shortcodeData = SHORTCODES[emojiData.hexcode];
64+
// If there's ever a gap in shortcode coverage, we fudge it by
65+
// filling it in with the emoji's CLDR annotation
66+
const shortcodeData = SHORTCODES[emojiData.hexcode] ??
67+
[emojiData.annotation.toLowerCase().replace(/ /g, "_")];
68+
6569
const emoji: IEmoji = {
6670
...emojiData,
6771
// Homogenize shortcodes by ensuring that everything is an array
68-
shortcodes: typeof shortcodeData === "string" ?
69-
[shortcodeData] :
70-
// If there's ever a gap in shortcode coverage, we fudge it by
71-
// filling it in with the emoji's CLDR annotation
72-
(shortcodeData ?? [emojiData.annotation.toLowerCase().replace(/ /g, "_")]),
72+
shortcodes: typeof shortcodeData === "string" ? [shortcodeData] : shortcodeData,
7373
};
7474

7575
const categoryId = EMOJIBASE_GROUP_ID_TO_CATEGORY[emoji.group];

0 commit comments

Comments
 (0)