git ssb

16+

Dominic / patchbay



Tree: 8cf292c13507a00dd6f025dfa662409737ba7dea

Files: 8cf292c13507a00dd6f025dfa662409737ba7dea / modules_extra / suggest-emoji.js

611 bytesRaw
1var plugs = require('../plugs')
2var emoji_url = plugs.first(exports.emoji_url = [])
3var emoji_names = plugs.first(exports.emoji_names = [])
4
5exports.suggest_mentions = function (word, cb) {
6 if (word[0] !== ':' || word.length < 2) return cb()
7 word = word.substr(1)
8 if (word[word.length-1] === ':') word = word.substr(0, word.length-1)
9 cb(null, emoji_names().filter(function (name) {
10 return name.substr(0, word.length) === word
11 }).slice(0, 50).map(function (emoji) {
12 return {
13 image: emoji_url(emoji),
14 title: emoji,
15 subtitle: emoji,
16 value: ':' + emoji + ':'
17 }
18 }))
19}
20

Built with git-ssb-web