Export sanitized list of emojis in emoji-index

release
Etienne Lemay 2016-07-20 14:45:42 -04:00
parent 0ebd5c4a5e
commit c1c604e8f1
1 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import data from '../../data'
import {getSanitizedData} from '.'
var emojisList = {}
var emoticonsList = {}
var index = lunr(function() {
@ -25,6 +26,8 @@ for (let emoji in data.emojis) {
}
}
emojisList[short_name] = getSanitizedData(short_name)
index.add({
id: short_name,
emoticons: emoticons,
@ -38,7 +41,7 @@ function search(value, maxResults = 75) {
if (value.length) {
results = index.search(tokenize(value)).map((result) =>
getSanitizedData(result.ref)
emojisList[result.ref]
)
results = results.slice(0, maxResults)
@ -59,4 +62,4 @@ function tokenize (string = '') {
return string.split(/[-|_|\s]+/)
}
export default { search, emoticons: emoticonsList }
export default { search, emojis: emojisList, emoticons: emoticonsList }