git ssb

1+

Daan Patchwork / patchwork



Tree: 770fe5e2a3d5973a5c9b7d0945b214c3b2ea6793

Files: 770fe5e2a3d5973a5c9b7d0945b214c3b2ea6793 / lib / message / sync / root.js

479 bytesRaw
1const ref = require('ssb-ref')
2
3module.exports = function (msg) {
4 if (msg && msg.value && msg.value.content) {
5 const type = msg.value.content.type
6 let root = msg.value.content.root
7
8 if (type === 'vote') {
9 root = msg.value.content.vote && msg.value.content.vote.link
10 } else if (type === 'about') {
11 root = msg.value.content.about
12 }
13
14 // only abouts and likes for messages (not feeds) will be returned
15 if (ref.isMsg(root)) return root
16 }
17}
18

Built with git-ssb-web