Build and expose a list of all emoticons in emoji-index

release
Etienne Lemay 2016-07-18 14:33:06 -04:00
parent 2d05276dc4
commit c3dca431ef
1 changed files with 9 additions and 1 deletions

View File

@ -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 }