git ssb

0+

Dominic / yap-tags



Tree: 4cafd1d101a0adaea7624b382b997d6581f6ba02

Files: 4cafd1d101a0adaea7624b382b997d6581f6ba02 / reduce.js

652 bytesRaw
1var ref = require('ssb-ref')
2
3module.exports = function (tag, data) {
4 if(!tag) tag = {
5 root: data.key,
6 branch: [],
7 creator: data.value.author,
8 created: data.value.timestamp,
9 contents: [],
10 name: null
11 }
12 else {
13 if(data.value.content.type === 'about')
14 tag.name = tag.name || data.value.content.name
15 if(ref.isMsg(data.value.content.message)) {
16 if(data.value.content.tagged === false)
17 tag.contents.splice(tag.contents.indexOf(data.value.content.message), 1)
18
19 if(!~tag.contents.indexOf(data.value.content.message))
20 tag.contents.push(data.value.content.message)
21 }
22 }
23
24 return tag
25}
26

Built with git-ssb-web