git ssb

0+

mixmix / scuttle-gathering



Tree: 05e5e97a80eb654ea1c48fa695db2c863c34a3c5

Files: 05e5e97a80eb654ea1c48fa695db2c863c34a3c5 / 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