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.
16 lines
372 B
16 lines
372 B
4 years ago
|
module.exports = function (iterator, cb) {
|
||
|
var data = []
|
||
|
var next = function () {
|
||
|
iterator.next(function (err, key, value) {
|
||
|
if (err || (key === undefined && value === undefined)) {
|
||
|
return iterator.end(function (err2) {
|
||
|
cb(err || err2, data)
|
||
|
})
|
||
|
}
|
||
|
data.push({ key: key, value: value })
|
||
|
next()
|
||
|
})
|
||
|
}
|
||
|
next()
|
||
|
}
|