git ssb

0+

Dominic / yap-tags



Tree: 4cafd1d101a0adaea7624b382b997d6581f6ba02

Files: 4cafd1d101a0adaea7624b382b997d6581f6ba02 / get.js

613 bytesRaw
1var Sort = require('ssb-sort')
2var Reduce = require('./reduce')
3var pull = require('pull-stream')
4
5module.exports = function (sbot, id, cb) {
6 sbot.get(id, function (err, msg) {
7 pull(
8 sbot.links({
9 dest: id, values: true
10 }),
11 pull.collect(function (err, ary) {
12 ary = ary.filter(function (e) {
13 return e.value.content.type == 'tag' || e.value.content.type == 'about'
14 })
15 ary.unshift({key: id, value:msg})
16 ary = Sort(ary)
17 var tag = ary.reduce(Reduce, null)
18 tag.branch = Sort.heads(ary)
19 cb(null, tag)
20 })
21 )
22 })
23}
24

Built with git-ssb-web