git ssb

16+

Dominic / patchbay



Tree: abc981ed003091aaeb68aab6d203e6356ea262a8

Files: abc981ed003091aaeb68aab6d203e6356ea262a8 / modules_extra / suggest-emoji.js

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

Built with git-ssb-web