From 3c840d18053cfcb85e91a3d869218c2bcb8eb246 Mon Sep 17 00:00:00 2001 From: solidsanek Date: Sun, 23 Oct 2022 00:35:47 +0200 Subject: [PATCH] Mfm autocomplete: remove unnecessary curry --- src/components/emoji_input/suggestor.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/emoji_input/suggestor.js b/src/components/emoji_input/suggestor.js index 49b83008..a0fe7a5b 100644 --- a/src/components/emoji_input/suggestor.js +++ b/src/components/emoji_input/suggestor.js @@ -15,7 +15,6 @@ const MFM_TAGS = ['blur', 'bounce', 'flip', 'font', 'jelly', 'jump', 'rainbow', export default data => { const emojiCurry = suggestEmoji(data.emoji) - const mfmCurry = suggestMfm() const usersCurry = data.store && suggestUsers(data.store) return input => { const firstChar = input[0] @@ -25,18 +24,14 @@ export default data => { if (firstChar === '@' && usersCurry) { return usersCurry(input) } - if (firstChar === '$' && mfmCurry) { - return mfmCurry(input) + if (firstChar === '$') { + return MFM_TAGS + .filter(({ replacement }) => replacement.toLowerCase().indexOf(input) !== -1) } return [] } } -export const suggestMfm = () => input => { - return MFM_TAGS - .filter(({ replacement }) => replacement.toLowerCase().indexOf(input) !== -1) -} - export const suggestEmoji = emojis => input => { const noPrefix = input.toLowerCase().substr(1) return emojis