Skip to content

Commit

Permalink
Merge pull request #19 from flumedb/fix-seqs-bug
Browse files Browse the repository at this point in the history
Fix bug where `opts = { seqs: true }`
  • Loading branch information
christianbundy committed May 7, 2019
2 parents e019e26 + 10d8ff3 commit f60c209
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 2 additions & 6 deletions inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,11 @@ module.exports = function (blocks, frame, codec, file, cache) {
return pull(
Looper(createStream(opts)),
filter(item => {
let value

if (opts && opts.seqs === false) {
value = item
return isNotDeleted(item)
} else {
value = { item }
return isNotDeleted(item.value)
}

return isNotDeleted(value)
})
)
},
Expand Down
12 changes: 12 additions & 0 deletions test/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ tape('stream', function (t) {

})

tape('stream with options', function (t) {
pull(
db.stream({min: 0, seqs: true}),
pull.collect(function (err, ary) {
if(err) throw err

t.deepEqual(ary.map(item => String(item.value)), ['hello offset db'])
t.end()
})
)
})

tape('live', function (t) {
t.deepEqual(live.map(String), ['hello world', 'hello offset db'])
t.end()
Expand Down

0 comments on commit f60c209

Please sign in to comment.