git ssb

16+

Dominic / patchbay



Tree: 0c056b3b97a2efd2fceb281c3d99ac1fe864be47

Files: 0c056b3b97a2efd2fceb281c3d99ac1fe864be47 / modules_extra / suggest-emoji.js

684 bytesRaw
1
2exports.needs = {
3 emoji_url: 'first',
4 emoji_names: 'first'
5}
6
7exports.gives = 'suggest_mentions'
8
9exports.create = function (api) {
10
11 return function (word) {
12 return function (cb) {
13 if (word[0] !== ':' || word.length < 2) return cb()
14 word = word.substr(1)
15 if (word[word.length-1] === ':') word = word.substr(0, word.length-1)
16 cb(null, api.emoji_names().filter(function (name) {
17 return name.substr(0, word.length) === word
18 }).slice(0, 50).map(function (emoji) {
19 return {
20 image: api.emoji_url(emoji),
21 title: emoji,
22 subtitle: emoji,
23 value: ':' + emoji + ':'
24 }
25 }))
26 }
27 }
28
29}
30

Built with git-ssb-web