Comparing version 0.2.0 to 0.2.1
@@ -27,6 +27,6 @@ var util = require('util') | ||
} | ||
if (this._pos == null && !this._reverse) this._pos = -1 | ||
} | ||
if (!options.start || !this._pos) | ||
//else | ||
this._pos = this._reverse ? this.db._keys.length - 1 : 0 | ||
@@ -38,18 +38,19 @@ } | ||
MemIterator.prototype._next = function (callback) { | ||
if (this._pos >= this.db._keys.length || this._pos < 0) | ||
var self = this | ||
if (self._pos >= self.db._keys.length || self._pos < 0) | ||
return setImmediate(callback) | ||
var key = this.db._keys[this._pos] | ||
var key = self.db._keys[self._pos] | ||
, value | ||
if (!!this._end && (this._reverse ? key < this._end : key > this._end)) | ||
if (!!self._end && (self._reverse ? key < self._end : key > self._end)) | ||
return setImmediate(callback) | ||
if (!!this._limit && this._limit > 0 && this._count++ >= this._limit) | ||
if (!!self._limit && self._limit > 0 && self._count++ >= self._limit) | ||
return setImmediate(callback) | ||
value = this.db._store['$' + key] | ||
this._pos += this._reverse ? -1 : 1 | ||
value = self.db._store['$' + key] | ||
self._pos += self._reverse ? -1 : 1 | ||
setImmediate(callback.bind(null, null, key, value)) | ||
setImmediate(function () { callback(null, key, value) }) | ||
} | ||
@@ -66,3 +67,4 @@ | ||
MemDOWN.prototype._open = function (options, callback) { | ||
setImmediate(function () { callback(null, this) }.bind(this)) | ||
var self = this | ||
setImmediate(function () { callback(null, self) }) | ||
} | ||
@@ -115,3 +117,3 @@ | ||
err = this._checkKeyValue(key, 'key') | ||
if (err) return setImmediate(callback.bind(null, err)) | ||
if (err) return setImmediate(function () { callback(err) }) | ||
if (array[i].type === 'del') { | ||
@@ -122,3 +124,3 @@ this._del(array[i].key, options, noop) | ||
err = this._checkKeyValue(value, 'value') | ||
if (err) return setImmediate(callback.bind(null, err)) | ||
if (err) return setImmediate(function () { callback(err) }) | ||
this._put(key, value, options, noop) | ||
@@ -136,2 +138,2 @@ } | ||
module.exports = MemDOWN | ||
module.exports = MemDOWN |
{ | ||
"name" : "memdown" | ||
, "description" : "An drop-in replacement for LevelDOWN that works in memory only" | ||
, "version" : "0.2.0" | ||
, "version" : "0.2.1" | ||
, "homepage" : "https://github.com/rvagg/node-memdown" | ||
@@ -9,2 +9,5 @@ , "authors" : [ | ||
] | ||
, "contributors" : [ | ||
"Julian Gruber <julian@juliangruber.com> (https://github.com/juliangruber)" | ||
] | ||
, "keywords" : [ "leveldb", "leveldown", "levelup", "memory" ] | ||
@@ -11,0 +14,0 @@ , "main" : "./memdown.js" |
Sorry, the diff of this file is not supported yet
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
17358
173
1