Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memdown

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memdown - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

38

memdown.js

@@ -14,3 +14,3 @@ var util = require('util')

AbstractIterator.call(this, db)
this._reverse = !!options.reverse
this._reverse = options.reverse
this._limit = options.limit

@@ -20,16 +20,30 @@ this._count = 0

this._start = options.start
this._gt = options.gt
this._gte = options.gte
this._lt = options.lt
this._lte = options.lte
if (this._start && bops.is(this._start) && this._start.length === 0)
this._start = null
if (this._end && bops.is(this._end) && this._end.length === 0)
this._end = null
var i
if (this._start) {
for (var i = 0; i < this.db._keys.length; i++) {
if (this.db._keys[i] >= options.start) {
this._pos = this._reverse && this.db._keys[i] != options.start ? i - 1 : i
for (i = 0; i < this.db._keys.length; i++) {
if (this.db._keys[i] >= this._start) {
this._pos = i
if (this.db._keys[i] != this._start) {
if (this._reverse) {
// going backwards and key doesn't match, jump back one
--this._pos
}
} else {
if (options.exclusiveStart) {
// key matches but it's a gt or lt
this._pos += (this._reverse ? -1 : 1)
}
}
break
}
}
if (this._pos == null && !this._reverse) this._pos = -1
if (this._pos == null && !this._reverse) // no matching keys, non starter
this._pos = -1
}

@@ -58,2 +72,8 @@

if ( (this._lt && key >= this._lt)
|| (this._lte && key > this._lte)
|| (this._gt && key <= this._gt)
|| (this._gte && key < this._gte))
return setImmediate(callback)
value = self.db._store[toKey(key)]

@@ -60,0 +80,0 @@ self._pos += self._reverse ? -1 : 1

{
"name" : "memdown"
, "description" : "An drop-in replacement for LevelDOWN that works in memory only"
, "version" : "0.4.1"
, "version" : "0.5.0"
, "homepage" : "https://github.com/rvagg/node-memdown"

@@ -19,3 +19,3 @@ , "authors" : [

, "dependencies" : {
"abstract-leveldown" : "~0.10.2"
"abstract-leveldown" : "~0.11.0"
, "bops" : "~0.1.0"

@@ -22,0 +22,0 @@ }

@@ -20,4 +20,3 @@ # MemDOWN

, levelup = require('levelup')
, factory = function (location) { return new MemDOWN(location) }
, db = levelup('/does/not/matter', { db: factory })
, db = levelup('/does/not/matter', { db: MemDOWN })

@@ -48,2 +47,2 @@ db.put('name', 'Yuri Irsenovich Kim')

MemDOWN is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
MemDOWN is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.

@@ -29,2 +29,4 @@ var test = require('tape')

require('abstract-leveldown/abstract/ranges-test').all(MemDOWN, test, testCommon)
test('unsorted entry, sorted iterator', function (t) {

@@ -31,0 +33,0 @@ var db = new MemDOWN('foo')

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc