From b3d5542a104de592919471354efea68f45a3d853 Mon Sep 17 00:00:00 2001 From: cswimr Date: Fri, 18 Oct 2024 13:05:48 -0400 Subject: [PATCH] remove useless try/catch --- src/emojipicker.tsx | 74 +++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/src/emojipicker.tsx b/src/emojipicker.tsx index 7861b96..0ee8c97 100644 --- a/src/emojipicker.tsx +++ b/src/emojipicker.tsx @@ -9,45 +9,41 @@ const denoCore: DenoCore = Deno[Deno.internal].core; export default function EmojiPicker(props: { text: string }): ReactNode | undefined { const text = props.text; - try { - if (text.length < 3) { - return undefined - }; - - const emoji = UnicodeEmoji.getEmojis().find(emoji => emoji.keywords.includes(text)); - if (!emoji) { - return undefined - }; - - return ( - - { - console.log(emoji.emoji) - await Clipboard.writeText(emoji.emoji); - showHud(`${emoji.emoji} copied to clipboard`); - }} - /> - - } - > - - - {text} - - - - - - {emoji.emoji} - - - - ) - } catch (e) { + if (text.length < 3) { return undefined }; + + const emoji = UnicodeEmoji.getEmojis().find(emoji => emoji.keywords.includes(text)); + if (!emoji) { + return undefined + }; + + return ( + + { + console.log(emoji.emoji) + await Clipboard.writeText(emoji.emoji); + showHud(`${emoji.emoji} copied to clipboard`); + }} + /> + + } + > + + + {text} + + + + + + {emoji.emoji} + + + + ); };