git ssb

0+

mixmix / scuttle-gathering



Tree: fa119a00e0a13307d66a09f8c482ae107ba31bdb

Files: fa119a00e0a13307d66a09f8c482ae107ba31bdb / lib / get-heads.js

452 bytesRaw
1const { heads } = require('ssb-sort')
2const getBacklinks = require('./get-backlinks')
3
4module.exports = function getHeads (server) {
5 if (arguments.length !== 1 || typeof arguments[0] !== 'object') throw new Error('getHeads needs a server as it\'s first argument!')
6
7 return function (gathering, cb) {
8 getBacklinks(server)(gathering, (err, backlinks) => {
9 if (err) cb(err)
10 else cb(null, heads([gathering, ...backlinks]))
11 })
12 }
13}
14

Built with git-ssb-web