deferred-leveldown
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -48,2 +48,4 @@ var util = require('util') | ||
DeferredLevelDOWN.prototype._iterator = function (options) { | ||
if (this._db) | ||
return this._db.iterator.apply(this._db, arguments) | ||
var it = new DeferredIterator(options) | ||
@@ -50,0 +52,0 @@ this._iterators.push(it) |
{ | ||
"name": "deferred-leveldown", | ||
"description": "For handling delayed-open on LevelDOWN compatible libraries", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"contributors": [ | ||
@@ -36,3 +36,3 @@ "Rod Vagg <r@va.gg> (https://github.com/rvagg)", | ||
"devDependencies": { | ||
"tape": "~1.0.4" | ||
"tape": "~4.1.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "scripts": { |
@@ -8,3 +8,3 @@ DeferredLevelDOWN | ||
[![Build Status](https://secure.travis-ci.org/Level/deferred-leveldown.png)](http://travis-ci.org/rvagg/deferred-leveldown) | ||
[![Build Status](https://secure.travis-ci.org/Level/deferred-leveldown.png)](http://travis-ci.org/Level/deferred-leveldown) | ||
@@ -11,0 +11,0 @@ [![NPM](https://nodei.co/npm/deferred-leveldown.png?compact)](https://nodei.co/npm/deferred-leveldown/) |
31
test.js
@@ -118,3 +118,2 @@ var test = require('tape') | ||
t.ok(nextFirst) | ||
t.end() | ||
}) | ||
@@ -137,1 +136,31 @@ | ||
}) | ||
test('iterator after setDb', function (t) { | ||
t.plan(5) | ||
var ld = new DeferredLevelDOWN('loc') | ||
var nextFirst = false | ||
ld.setDb({ iterator: function (options) { | ||
return { | ||
next : function (cb) { | ||
cb(null, 'key', 'value') | ||
} | ||
, end : function (cb) { | ||
process.nextTick(cb) | ||
} | ||
} | ||
}}) | ||
var it = ld.iterator() | ||
it.next(function (err, key, value) { | ||
nextFirst = true | ||
t.error(err) | ||
t.equal(key, 'key') | ||
t.equal(value, 'value') | ||
}) | ||
it.end(function (err) { | ||
t.error(err) | ||
t.ok(nextFirst) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15398
218