Skip to content

Commit

Permalink
Refactor collectEntries() into level-concat-iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphtheninja committed Jul 4, 2018
1 parent 23b4ccd commit a2a5f6b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"devDependencies": {
"airtap": "0.0.8",
"level-concat-iterator": "^2.0.0",
"rimraf": "^2.6.1",
"sinon": "^6.0.0",
"standard": "^11.0.0",
Expand Down
18 changes: 1 addition & 17 deletions testCommon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var path = require('path')
var fs = !process.browser && require('fs')
var rimraf = !process.browser && require('rimraf')
var collectEntries = require('level-concat-iterator')

var dbidx = 0

Expand Down Expand Up @@ -46,23 +47,6 @@ var tearDown = function (t) {
setUp(t) // same cleanup!
}

var collectEntries = function (iterator, callback) {
var data = []
var next = function () {
iterator.next(function (err, key, value) {
if (err) return callback(err)
if (!arguments.length) {
return iterator.end(function (err) {
callback(err, data)
})
}
data.push({ key: key, value: value })
setTimeout(next, 0)
})
}
next()
}

module.exports = {
location: location,
cleanup: cleanup,
Expand Down

0 comments on commit a2a5f6b

Please sign in to comment.