hyperlog-concestor
compute the most recent common ancestor among nodes in a hyperlog
example
var concestor =var hyperlog =var db =var log =var links =A:B: 'A'C: 'B'D: 'C'E: 'D'F: 'B'G: 'F'H: 'G''E'I: 'H'var keys = Objectvar nodes = {} names = {} hashes = {}; {if keyslength === 0 returnvar key = keysvar ln = linkskeylog}{}
output:
CONCESTORS of G, F, E: [ 'B' ]
api
var concestor =
concestor(log, hashes, cb)
Compute the concestor
of an array of hashes
present in a hyperlog log
. cb(err, cons)
fires with
the array of concestors (there may be ties).
This module is not very coupled to hyperlog. Any log
object with a
.get(function (err, node) {})
and a node.links
array of hashes will work.
install
npm install hyperlog-concestor
license
BSD