ssb-thread-schema
I made a module for you
var { isRoot, isReply, isFork, isNestedReply } = require('ssb-thread-schema')
const testMsg = {
type: 'post',
text: 'oh choice, finally a less janky way to check our stuff',
root: '%+fBXl12aV1wpAdD62RMl1WRhwthDMuAuHH4iNWgB7jA=.sha256',
fork: '%PK5aWmXVYJLcmRQTc/6EQE1ht9T5Kb+wi6NgTReMKXI=.sha256'
}
// can be the content of a message or the whole thing
isFork(testMsg)
// => false
isFork.errors
// => helpful errors
isNestedReply(testMsg)
// => true
more info : https://github.com/ssbc/ssb-thread-schema