append-tree
append-tree copied to clipboard
README tweak
In the readme, you mention that the hypercore feed can be faked with:
any append-only log that supports
.append()and.length
But in testing, I found more was needed. So I made a simple minimal interface.
// Fake hypercore feed for testing and learning
var values = []
var feed = {
append (value, cb) {
console.log('APPEND', {value, cb})
values.push(value)
nextTick(cb)
},
get (index, options, cb) {
console.log('GET', {index, options, cb})
nextTick(cb, null, values[index])
},
get length () {
console.log('LENGTH')
return values.length
},
ready (cb) {
console.log('READY', {cb})
nextTick(cb)
}
}
Maybe mention it needs all 4 and .length is a getter.