From c3dca431eff83544d18d7ebc90b4897828ffabb1 Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Mon, 18 Jul 2016 14:33:06 -0400 Subject: [PATCH] Build and expose a list of all emoticons in emoji-index --- src/utils/emoji-index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/emoji-index.js b/src/utils/emoji-index.js index bb41c31..a811550 100644 --- a/src/utils/emoji-index.js +++ b/src/utils/emoji-index.js @@ -1,6 +1,8 @@ import lunr from 'lunr' import data from '../../data' +var emoticonsList = [] + var index = lunr(function() { this.pipeline.reset() @@ -15,6 +17,12 @@ for (let emoji in data.emojis) { let emojiData = data.emojis[emoji], { short_name, name, emoticons } = emojiData + for (let emoticon of emoticons) { + if (emoticonsList.indexOf(emoticon) == -1) { + emoticonsList.push(emoticon) + } + } + index.add({ id: short_name, emoticons: emoticons, @@ -49,4 +57,4 @@ function tokenize (string = '') { return string.split(/[-|_|\s]+/) } -export default { search } +export default { search, emoticons: emoticonsList }