git ssb

16+

Dominic / patchbay



Tree: d20fb6972ed016e0dfeadef9da886fa2caa08a41

Files: d20fb6972ed016e0dfeadef9da886fa2caa08a41 / modules_basic / suggest-mentions.js

753 bytesRaw
1var pull = require('pull-stream')
2var cont = require('cont')
3function isImage (filename) {
4 return /\.(gif|jpg|png|svg)$/i.test(filename)
5}
6
7var sbot_links2 = require('../plugs').first(exports.sbot_links2 = [])
8var blob_url = require('../plugs').first(exports.blob_url = [])
9var signified = require('../plugs').first(exports.signified = [])
10
11exports.suggest = cont.to(function (word, cb) {
12 if(!/^@\w/.test(word)) return cb()
13
14
15 signified(word, function (err, names) {
16 if(err) cb(err)
17 else cb(null, names.map(function (e) {
18 return {
19 title: e.name + ': ' + e.id.substring(0,10)+' ('+e.rank+')',
20 value: '['+e.name+']('+e.id+')',
21 rank: e.rank,
22 //TODO: avatar images...
23 }
24 }))
25 })
26})
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

Built with git-ssb-web