You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
469 B
26 lines
469 B
5 years ago
|
var pushable = require('pull-pushable')
|
||
|
var cat = require('pull-cat')
|
||
|
var post = require('level-post')
|
||
|
|
||
|
module.exports = function (db, opts) {
|
||
|
opts = opts || {}
|
||
|
|
||
|
var l = pushable(function (err) {
|
||
|
if(opts.onAbort) opts.onAbort(err)
|
||
|
cleanup()
|
||
|
})
|
||
|
|
||
|
var cleanup = post(db, opts, function (ch) {
|
||
|
if(opts.keys === false)
|
||
|
l.push(ch.value)
|
||
|
else if(opts.values === false)
|
||
|
l.push(ch.key)
|
||
|
else
|
||
|
l.push(ch)
|
||
|
})
|
||
|
|
||
|
return l
|
||
|
|
||
|
}
|
||
|
|