Build and expose a list of all emoticons in emoji-index
parent
2d05276dc4
commit
c3dca431ef
|
@ -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 }
|
||||
|
|
Loading…
Reference in New Issue