2018-03-27 18:51:26 +00:00
|
|
|
export default (data) => {
|
2017-05-24 16:34:10 +00:00
|
|
|
const search = []
|
|
|
|
|
|
|
|
var addToSearch = (strings, split) => {
|
2017-05-26 07:43:11 +00:00
|
|
|
if (!strings) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-03-27 18:51:26 +00:00
|
|
|
;(Array.isArray(strings) ? strings : [strings]).forEach((string) => {
|
|
|
|
;(split ? string.split(/[-|_|\s]+/) : [string]).forEach((s) => {
|
2017-05-24 16:34:10 +00:00
|
|
|
s = s.toLowerCase()
|
|
|
|
|
|
|
|
if (search.indexOf(s) == -1) {
|
|
|
|
search.push(s)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
addToSearch(data.short_names, true)
|
|
|
|
addToSearch(data.name, true)
|
|
|
|
addToSearch(data.keywords, false)
|
|
|
|
addToSearch(data.emoticons, false)
|
|
|
|
|
2017-09-30 14:37:13 +00:00
|
|
|
return search.join(',')
|
2017-05-24 16:34:10 +00:00
|
|
|
}
|