git ssb

7+

dinoworm ๐Ÿ› / patchcore



Tree: 0b68762e851dab73abc45fa60add0d96d3b5c7ac

Files: 0b68762e851dab73abc45fa60add0d96d3b5c7ac / message / obs / author.js

562 bytesRaw
1var Value = require('mutant/value')
2var ref = require('ssb-ref')
3var nest = require('depnest')
4
5exports.needs = nest('sbot.async.get', 'first')
6
7exports.gives = nest('message.obs.author')
8
9exports.create = function (api) {
10 return nest('message.obs.author', function (id) {
11 if (!ref.isLink(id)) throw new Error('an id must be specified')
12 var result = Value()
13
14 if (ref.isMsg(id)) {
15 api.sbot.async.get(id, function (err, value) {
16 if (err) console.error(err)
17 else result.set(value.author)
18 })
19 }
20
21 return result
22 })
23}
24

Built with git-ssb-web