Replace dashes to underscores in emoji autocompletion

This commit is contained in:
Pavel Djundik 2020-08-13 10:47:50 +03:00
parent b6782da837
commit 19d6b7d98f
2 changed files with 12 additions and 5 deletions

View File

@ -613,7 +613,7 @@
"dragon_face": "🐲",
"dragon": "🐉",
"sauropod": "🦕",
"t-rex": "🦖",
"t_rex": "🦖",
"whale": "🐳",
"whale2": "🐋",
"dolphin": "🐬",
@ -1082,7 +1082,7 @@
"game_die": "🎲",
"jigsaw": "🧩",
"teddy_bear": "🧸",
"pi_ata": "🪅",
"pinata": "🪅",
"nesting_dolls": "🪆",
"spades": "♠️",
"hearts": "♥️",
@ -1240,7 +1240,7 @@
"chart": "💹",
"email": "✉️",
"envelope": "✉️",
"e-mail": "📧",
"e_mail": "📧",
"incoming_envelope": "📨",
"envelope_with_arrow": "📩",
"outbox_tray": "📤",
@ -1376,7 +1376,7 @@
"no_bicycles": "🚳",
"no_smoking": "🚭",
"do_not_litter": "🚯",
"non-potable_water": "🚱",
"non_potable_water": "🚱",
"no_pedestrians": "🚷",
"no_mobile_phones": "📵",
"underage": "🔞",

View File

@ -19,7 +19,14 @@ const emojiModifiersRegex = /[\u{1f3fb}-\u{1f3ff}]|\u{fe0f}/gu;
const cleanEmoji = emoji.emoji.replace(emojiModifiersRegex, "");
fullNameEmojiMap[cleanEmoji] = emoji.description;
for (const alias of emoji.aliases) {
for (let alias of emoji.aliases) {
if (alias !== "-1") {
// Replace dashes to underscores except for :-1:
// This removes autocompletion prompt for :-P
// prompting for :non-potable_water:
alias = alias.replace(/-/g, "_");
}
emojiMap[alias] = emoji.emoji;
}
}