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

level-spaces

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-spaces - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

42

level-spaces.js

@@ -5,12 +5,15 @@ var levelup = require('levelup')

, separator = '\xff'
, defaultOptions = {
separator: '~'
}
function space (db, prefix, options) {
if (typeof prefix != 'string')
throw new TypeError('prefix must be a String')
function space (db, name, options) {
if (typeof name != 'string')
throw new TypeError('name must be a String')
var sp = separator + prefix + separator
, options = xtend(options)
options = xtend(defaultOptions, options)
var keyPrefix = options.separator + name + options.separator
function encode (key) {

@@ -21,3 +24,3 @@ if (key == null)

var skey = typeof key == 'string' ? key : key.toString('utf8')
return sp + skey
return keyPrefix + skey
}

@@ -30,4 +33,4 @@

var skey = typeof key == 'string' ? key : key.toString('utf8')
if (skey.substring(0, sp.length) === sp)
return skey.substring(sp.length)
if (skey.substring(0, keyPrefix.length) === keyPrefix)
return skey.substring(keyPrefix.length)
return skey

@@ -56,3 +59,2 @@ }

return levelup(options)

@@ -114,19 +116,19 @@ }

if (!options.reverse) {
options.gte = encode(options.start || '\x00')
options.lte = encode(options.end || '\xff')
options.gte = options.start || '\x00'
options.lte = options.end || '\x7f'
} else {
options.gte = encode(options.end || '\x00')
options.lte = encode(options.start || '\xff')
options.gte = options.end || '\x00'
options.lte = options.start || '\x7f'
}
delete options.start
delete options.end
} else { // !start && !end
options.gte = encode(options.gte)
options.gt = encode(options.gt)
options.lte = encode(options.lte)
options.lt = encode(options.lt)
}
options.gte = encode(options.gte)
options.gt = encode(options.gt)
options.lte = encode(options.lte)
options.lt = encode(options.lt)
if (options.lte == null && options.lt == null)
options.lte = encode('\xff')
options.lte = encode('\x7f')
if (options.gte == null && options.gt == null)

@@ -133,0 +135,0 @@ options.gte = encode('\x00')

{
"name": "level-spaces",
"version": "1.1.1",
"version": "2.0.0",
"description": "Namespaced LevelUP instances",

@@ -27,4 +27,4 @@ "main": "level-spaces.js",

"dependencies": {
"level-updown": ">=1.1.0 <1.2.0-0",
"levelup": ">=0.18.6 <0.19.0-0",
"level-updown": ">=2.0.0 <2.1.0-0",
"levelup": ">=0.19.0 <0.20.0-0",
"xtend": ">=4.0.0 <4.1.0-0"

@@ -31,0 +31,0 @@ },

@@ -20,8 +20,10 @@ # level-spaces

A namespace is specified as a `String`. This `String` has the character `\xff` (`'ÿ'`) prepended to the beginning and appended to the end and is then *prefixed* to all reads and writes to the underlying LevelUP.
A namespace is specified as a `String`. This `String` has the character `~` (configurable) prepended to the beginning and appended to the end and is then *prefixed* to all reads and writes to the underlying LevelUP.
So, if you have a namespace of `'foobar'`, all keys written will transparently be prefixed with `'\xfffoobar\xff'` and all reads will have keys transparently prefixed with `'\xfffoobar\xff'`. All keys that come from an iterator / read-stream will also have `'\xfffoobar\xff'` removed from them, making the prefixing entirely transparent. You will not be able to see the raw keys from a **level-spaces** instance but they will be visible from the LevelUP used to create it.
So, if you have a namespace of `'foobar'`, all keys written will transparently be prefixed with `'~foobar~'` and all reads will have keys transparently prefixed with `'~foobar~'`. All keys that come from an iterator / read-stream will also have `'~foobar~'` removed from them, making the prefixing entirely transparent. You will not be able to see the raw keys from a **level-spaces** instance but they will be visible from the LevelUP used to create it.
If you have multiple levels of **level-spaces** you will end up with multiple prefixes appended one after the other, each surrounded by `\xff`. So a **level-spaces** instance with the prefix `'foobar'` that is passed back in to create a new **level-spaces** instance with a prefix `'doobar'` will end up using keys prefixed with `\xfffoobar\xff\xffdoobar\xff`.
Note, however, that **child namespaces will not be hidden** from within a level-spaces instance. If you have a heirarchy of namespaces, or are using additional libaries that do, take care, particularly when using read streams, to operate only on the keys you actually want.
If you have multiple levels of **level-spaces** you will end up with multiple prefixes appended one after the other, each surrounded by `~`. So a **level-spaces** instance with the prefix `'foobar'` that is passed back in to create a new **level-spaces** instance with a prefix `'doobar'` will end up using keys prefixed with `~foobar~~doobar~`.
Additionally, when you call `createReadStream()` on a LevelUP created by **level-spaces**, the options will be rewritten to properly account for the underlying namespace: `'start'`, `'end'`, `'gt'`, `'gte'`, `'lt'`, `'lte'`, so the LevelUP read-stream operates only within the namespace as if there was no other range of keys in the store.

@@ -43,6 +45,7 @@

;[ db, space1, space2, space1_1 ].forEach(function (db) {
db.put('foo', 'bar', function () {
db.get('foo', function (err, value) {
console.log('[%s] = [%s]', 'foo', value)
;[ db, space1, space2, space1_1 ].forEach(function (db, i) {
var key = 'foo ' + i
db.put(key, 'bar ' + i, function () {
db.get(key, function (err, value) {
console.log('[%s] = [%s]', key, value)
done()

@@ -79,6 +82,8 @@ })

The optional `options` object will be passed to LevelUP.
The optional `options` object will be passed to LevelUP but can also contain:
* `'separator'`: to override the default `'~'` separator with something custom.
## License
**level-spaces** is Copyright (c) 2014 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.md file for more details.

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

function dbEquals (ldb, t) {
return function (expected) {
return function (expected, callback) {
readStreamToList(ldb.createReadStream(), function (err, data) {
t.ifError(err, 'no error')
t.deepEqual(data, expected, 'database contains expected entries')
callback()
})

@@ -42,2 +42,3 @@ }

return function (t) {
rimraf.sync(testDb)
levelup(testDb, function (err, ldb) {

@@ -64,2 +65,3 @@ t.ifError(err, 'no error')

test('test puts', dbWrap(function (t, ldb) {

@@ -77,11 +79,41 @@ var dbs = [

t.dbEquals([
{ 'bar0' : 'foo0' }
, { 'foo0' : 'bar0' }
, { '\xfftest space 1\xffbar1' : 'foo1' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 2\xffbar2' : 'foo2' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
])
{ 'bar0' : 'foo0' }
, { 'foo0' : 'bar0' }
, { '~test space 1~bar1' : 'foo1' }
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 2~bar2' : 'foo2' }
, { '~test space 2~foo2' : 'bar2' }
], t.end)
}
t.end()
dbs.forEach(function (db, i) {
db.put('foo' + i, 'bar' + i, done)
db.put('bar' + i, 'foo' + i, done)
})
}))
test('test separator', dbWrap(function (t, ldb) {
var idb
, dbs = [
ldb
, spaces(ldb, 'test space 1', { separator: 'M' })
, idb = spaces(ldb, 'test space 2', { separator: ';' })
, spaces(idb, 'inner space', { separator: '*' })
]
, done = after(dbs.length * 2, verify)
function verify (err) {
t.ifError(err, 'no error')
t.dbEquals([
{ ';test space 2;*inner space*bar3' : 'foo3' }
, { ';test space 2;*inner space*foo3' : 'bar3' }
, { ';test space 2;bar2' : 'foo2' }
, { ';test space 2;foo2' : 'bar2' }
, { 'Mtest space 1Mbar1' : 'foo1' }
, { 'Mtest space 1Mfoo1' : 'bar1' }
, { 'bar0' : 'foo0' }
, { 'foo0' : 'bar0' }
], t.end)
}

@@ -109,17 +141,15 @@

t.dbEquals([
{ 'bar0' : 'foo0' }
, { 'foo0' : 'bar0' }
, { '\xfftest space 1\xffbar1' : 'foo1' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 1\xff\xffinner space 1\xffbar3' : 'foo3' }
, { '\xfftest space 1\xff\xffinner space 1\xfffoo3' : 'bar3' }
, { '\xfftest space 1\xff\xffinner space 2\xffbar4' : 'foo4' }
, { '\xfftest space 1\xff\xffinner space 2\xfffoo4' : 'bar4' }
, { '\xfftest space 2\xffbar2' : 'foo2' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
, { '\xfftest space 2\xff\xffinner space 1\xffbar5' : 'foo5' }
, { '\xfftest space 2\xff\xffinner space 1\xfffoo5' : 'bar5' }
])
t.end()
{ 'bar0' : 'foo0' }
, { 'foo0' : 'bar0' }
, { '~test space 1~bar1' : 'foo1' }
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 1~~inner space 1~bar3' : 'foo3' }
, { '~test space 1~~inner space 1~foo3' : 'bar3' }
, { '~test space 1~~inner space 2~bar4' : 'foo4' }
, { '~test space 1~~inner space 2~foo4' : 'bar4' }
, { '~test space 2~bar2' : 'foo2' }
, { '~test space 2~foo2' : 'bar2' }
, { '~test space 2~~inner space 1~bar5' : 'foo5' }
, { '~test space 2~~inner space 1~foo5' : 'bar5' }
], t.end)
}

@@ -229,7 +259,5 @@

{ 'foo0' : 'bar0' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
])
t.end()
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 2~foo2' : 'bar2' }
], t.end)
}

@@ -271,11 +299,9 @@

t.dbEquals([
{ 'foo0' : 'bar0' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 1\xff\xffinner space 1\xfffoo3' : 'bar3' }
, { '\xfftest space 1\xff\xffinner space 2\xfffoo4' : 'bar4' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
, { '\xfftest space 2\xff\xffinner space 1\xfffoo5' : 'bar5' }
])
t.end()
{ 'foo0' : 'bar0' }
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 1~~inner space 1~foo3' : 'bar3' }
, { '~test space 1~~inner space 2~foo4' : 'bar4' }
, { '~test space 2~foo2' : 'bar2' }
, { '~test space 2~~inner space 1~foo5' : 'bar5' }
], t.end)
}

@@ -320,14 +346,12 @@

t.dbEquals([
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '\xfftest space 1\xffbang1' : 'boom1' }
, { '\xfftest space 1\xffboom1' : 'bang1' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 2\xffbang2' : 'boom2' }
, { '\xfftest space 2\xffboom2' : 'bang2' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
])
t.end()
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '~test space 1~bang1' : 'boom1' }
, { '~test space 1~boom1' : 'bang1' }
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 2~bang2' : 'boom2' }
, { '~test space 2~boom2' : 'bang2' }
, { '~test space 2~foo2' : 'bar2' }
], t.end)
}

@@ -373,23 +397,21 @@

t.dbEquals([
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '\xfftest space 1\xffbang1' : 'boom1' }
, { '\xfftest space 1\xffboom1' : 'bang1' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 1\xff\xffinner space 1\xffbang3' : 'boom3' }
, { '\xfftest space 1\xff\xffinner space 1\xffboom3' : 'bang3' }
, { '\xfftest space 1\xff\xffinner space 1\xfffoo3' : 'bar3' }
, { '\xfftest space 1\xff\xffinner space 2\xffbang4' : 'boom4' }
, { '\xfftest space 1\xff\xffinner space 2\xffboom4' : 'bang4' }
, { '\xfftest space 1\xff\xffinner space 2\xfffoo4' : 'bar4' }
, { '\xfftest space 2\xffbang2' : 'boom2' }
, { '\xfftest space 2\xffboom2' : 'bang2' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
, { '\xfftest space 2\xff\xffinner space 1\xffbang5' : 'boom5' }
, { '\xfftest space 2\xff\xffinner space 1\xffboom5' : 'bang5' }
, { '\xfftest space 2\xff\xffinner space 1\xfffoo5' : 'bar5' }
])
t.end()
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '~test space 1~bang1' : 'boom1' }
, { '~test space 1~boom1' : 'bang1' }
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 1~~inner space 1~bang3' : 'boom3' }
, { '~test space 1~~inner space 1~boom3' : 'bang3' }
, { '~test space 1~~inner space 1~foo3' : 'bar3' }
, { '~test space 1~~inner space 2~bang4' : 'boom4' }
, { '~test space 1~~inner space 2~boom4' : 'bang4' }
, { '~test space 1~~inner space 2~foo4' : 'bar4' }
, { '~test space 2~bang2' : 'boom2' }
, { '~test space 2~boom2' : 'bang2' }
, { '~test space 2~foo2' : 'bar2' }
, { '~test space 2~~inner space 1~bang5' : 'boom5' }
, { '~test space 2~~inner space 1~boom5' : 'bang5' }
, { '~test space 2~~inner space 1~foo5' : 'bar5' }
], t.end)
}

@@ -434,14 +456,12 @@

t.dbEquals([
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '\xfftest space 1\xffbang1' : 'boom1' }
, { '\xfftest space 1\xffboom1' : 'bang1' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 2\xffbang2' : 'boom2' }
, { '\xfftest space 2\xffboom2' : 'bang2' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
])
t.end()
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '~test space 1~bang1' : 'boom1' }
, { '~test space 1~boom1' : 'bang1' }
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 2~bang2' : 'boom2' }
, { '~test space 2~boom2' : 'bang2' }
, { '~test space 2~foo2' : 'bar2' }
], t.end)
}

@@ -487,23 +507,21 @@

t.dbEquals([
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '\xfftest space 1\xffbang1' : 'boom1' }
, { '\xfftest space 1\xffboom1' : 'bang1' }
, { '\xfftest space 1\xfffoo1' : 'bar1' }
, { '\xfftest space 1\xff\xffinner space 1\xffbang3' : 'boom3' }
, { '\xfftest space 1\xff\xffinner space 1\xffboom3' : 'bang3' }
, { '\xfftest space 1\xff\xffinner space 1\xfffoo3' : 'bar3' }
, { '\xfftest space 1\xff\xffinner space 2\xffbang4' : 'boom4' }
, { '\xfftest space 1\xff\xffinner space 2\xffboom4' : 'bang4' }
, { '\xfftest space 1\xff\xffinner space 2\xfffoo4' : 'bar4' }
, { '\xfftest space 2\xffbang2' : 'boom2' }
, { '\xfftest space 2\xffboom2' : 'bang2' }
, { '\xfftest space 2\xfffoo2' : 'bar2' }
, { '\xfftest space 2\xff\xffinner space 1\xffbang5' : 'boom5' }
, { '\xfftest space 2\xff\xffinner space 1\xffboom5' : 'bang5' }
, { '\xfftest space 2\xff\xffinner space 1\xfffoo5' : 'bar5' }
])
t.end()
{ 'bang0' : 'boom0' }
, { 'boom0' : 'bang0' }
, { 'foo0' : 'bar0' }
, { '~test space 1~bang1' : 'boom1' }
, { '~test space 1~boom1' : 'bang1' }
, { '~test space 1~foo1' : 'bar1' }
, { '~test space 1~~inner space 1~bang3' : 'boom3' }
, { '~test space 1~~inner space 1~boom3' : 'bang3' }
, { '~test space 1~~inner space 1~foo3' : 'bar3' }
, { '~test space 1~~inner space 2~bang4' : 'boom4' }
, { '~test space 1~~inner space 2~boom4' : 'bang4' }
, { '~test space 1~~inner space 2~foo4' : 'bar4' }
, { '~test space 2~bang2' : 'boom2' }
, { '~test space 2~boom2' : 'bang2' }
, { '~test space 2~foo2' : 'bar2' }
, { '~test space 2~~inner space 1~bang5' : 'boom5' }
, { '~test space 2~~inner space 1~boom5' : 'bang5' }
, { '~test space 2~~inner space 1~foo5' : 'bar5' }
], t.end)
}

@@ -519,19 +537,140 @@

test('explicit json valueEncoding', dbWrap(function (t, ldb) {
var thing = { one: 'two', three: 'four' }
, opt = { valueEncoding: 'json'}
, jsonDb = spaces(ldb, 'json-things', opt)
jsonDb.put('thing', thing, opt, function (err) {
t.ifError(err, 'no error')
jsonDb.get('thing', opt, function (err, got) {
t.ifError(err, 'no error')
t.ok(got, 'got something back!')
t.equal(typeof got, 'object', 'got back an object')
t.deepEqual(got, thing, 'got back the right thing')
t.end()
})
})
}))
test('explicit json on db valueEncoding raw entry', dbWrap(function (t, ldb) {
var sdb = spaces(ldb, 'json-things', { valueEncoding: 'json' })
, thing = { one: 'two', three: 'four' }
sdb.put('thing', thing, function (err) {
t.error(err)
ldb.get('~json-things~thing', { valueEncoding: 'utf8' }, function (err, value) {
t.error(err)
t.equal(typeof value, 'string')
t.equal(value, JSON.stringify(thing))
t.end()
})
})
}))
test('explicit json on put valueEncoding raw entry', dbWrap(function (t, ldb) {
var sdb = spaces(ldb, 'json-things')
, thing = { one: 'two', three: 'four' }
sdb.put('thing', thing, { valueEncoding: 'json' }, function (err) {
t.error(err)
ldb.get('~json-things~thing', { valueEncoding: 'utf8' }, function (err, value) {
t.error(err)
t.equal(typeof value, 'string')
t.equal(value, JSON.stringify(thing))
t.end()
})
})
}))
/*
test('nested value encodings, utf8 on top', function (t) {
var db = levelup(testDb, { valueEncoding: 'json' })
, sp1 = spaces(db, 'sp1', { valueEncoding: 'utf8' })
, sp2 = spaces(sp1, 'sp2', { valueEncoding: 'json' })
, sp3 = spaces(sp2, 'sp3', { valueEncoding: 'utf8' })
, v = '{"an":"object"}'
sp3.put('k', v, function (err) {
t.error(err)
sp3.get('k', function (err, value) {
t.error(err)
t.equal(typeof value, 'string')
t.equal(value, v)
db.close(t.end)
})
})
})
test('nested value encodings, json on top', function (t) {
var db = levelup(testDb, { valueEncoding: 'json' })
, sp1 = spaces(db, 'sp1', { valueEncoding: 'utf8' })
, sp2 = spaces(sp1, 'sp2', { valueEncoding: 'json' })
, sp3 = spaces(sp2, 'sp3', { valueEncoding: 'utf8' })
, sp4 = spaces(sp3, 'sp4', { valueEncoding: 'json' })
, v = { an: 'object' }
sp4.put('k', v, function (err) {
t.error(err)
sp4.get('k', function (err, value) {
t.error(err)
t.equal(typeof value, 'object')
t.deepEqual(value, v)
db.close(t.end)
})
})
})
test('nested value encodings, override', function (t) {
var db = levelup(testDb, { valueEncoding: 'json' })
, sp1 = spaces(db, 'sp1', { valueEncoding: 'utf8' })
, sp2 = spaces(sp1, 'sp2', { valueEncoding: 'json' })
, sp3 = spaces(sp2, 'sp3', { valueEncoding: 'utf8' })
, v = { an: 'object' }
sp3.put('k', v, { valueEncoding: 'json' }, function (err) {
t.error(err)
sp3.get('k', { valueEncoding: 'json' }, function (err, value) {
t.error(err)
t.equal(typeof value, 'object')
t.deepEqual(value, v)
db.close(t.end)
})
})
})
*/
function readStreamTest (options) {
test('test readStream with ' + inspect(options), function (t) {
var refDb = levelup(testDb + '.ref')
var ref1Db = levelup(testDb + '.ref')
, ref2Db = levelup(testDb + '.ref2')
, ldb = levelup(testDb)
, sdb1 = spaces(ldb, 'test space')
, sdb2 = spaces(sdb1, 'inner space ')
, refList
, ref1List
, ref2List
, sdb1List
, sdb2List
, done = after(2, prepare)
, done = after(3, prepare)
refDb.on('ready', done)
ref1Db.on('ready', done)
ref2Db.on('ready', done)
ldb.on('ready', done)
function prepare () {
var batches = [ refDb.batch(), ldb.batch(), sdb1.batch(), sdb2.batch() ]
, done = after(batches.length, exec)
var ref1Batch = ref1Db.batch()
, batches = [ ref1Batch, ref2Db.batch(), ldb.batch(), sdb1.batch(), sdb2.batch() ]
, done = after(batches.length, exec)

@@ -542,2 +681,4 @@ for (var i = 0; i < 200; i++) {

})
// we simulate the inner space in a separate db, not trying to hide it
ref1Batch.put('~inner space ~key' + i, 'value' + i)
}

@@ -551,10 +692,16 @@

function exec () {
var done = after(3, verify)
var done = after(4, verify)
readStreamToList(refDb.createReadStream(options), function (err, data) {
readStreamToList(ref1Db.createReadStream(options), function (err, data) {
t.ifError(err, 'no error')
refList = data
ref1List = data
done()
})
readStreamToList(ref2Db.createReadStream(options), function (err, data) {
t.ifError(err, 'no error')
ref2List = data
done()
})
readStreamToList(sdb1.createReadStream(options), function (err, data) {

@@ -574,3 +721,3 @@ t.ifError(err, 'no error')

function verify () {
var done = after(2, function (err) {
var done = after(3, function (err) {
t.ifError(err, 'no error')

@@ -582,8 +729,18 @@ rimraf.sync(testDb)

t.equal(sdb1List.length, refList.length, 'space db returned correct number of entries (' + refList.length + ')')
t.equal(sdb2List.length, refList.length, 'inner space db returned correct number of entries (' + refList.length + ')')
t.deepEqual(sdb1List, refList, 'space db returned same entries as reference db')
t.deepEqual(sdb2List, refList, 'inner space db returned same entries as reference db')
t.equal(
sdb1List.length
, ref1List.length
, 'inner space db returned correct number of entries (' + ref1List.length + ')'
)
t.deepEqual(sdb1List, ref1List, 'inner space db returned same entries as reference db')
refDb.close(done)
t.equal(
sdb2List.length
, ref2List.length
, 'inner space db returned correct number of entries (' + ref2List.length + ')'
)
t.deepEqual(sdb2List, ref2List, 'inner space db returned same entries as reference db')
ref1Db.close(done)
ref2Db.close(done)
ldb.close(done)

@@ -594,2 +751,3 @@ }

readStreamTest({})

@@ -651,2 +809,1 @@ readStreamTest({ start: 'key0', end: 'key50' })

readStreamTest({ lte: 'key50', reverse: true, limit: 40 })
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