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

level-sublevel

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-sublevel - npm Package Compare versions

Comparing version 4.6.4 to 4.6.5

1

index.js

@@ -54,2 +54,3 @@ var EventEmitter = require('events').EventEmitter

else opts.end = opts.end || sep
return fun.call(db, opts)

@@ -56,0 +57,0 @@ }

6

package.json
{
"name": "level-sublevel",
"description": "",
"version": "4.6.4",
"version": "4.6.5",
"homepage": "https://github.com/dominictarr/level-sublevel",

@@ -11,3 +11,3 @@ "repository": {

"dependencies": {
"level-hooks": "~4.1.6",
"level-hooks": "~4.1.10",
"string-range": "~1.2.1",

@@ -17,3 +17,3 @@ "level-fix-range": "~1.1.2"

"devDependencies": {
"levelup": "~0.8.0",
"level": "~0.9.0",
"rimraf": "~2.1.4",

@@ -20,0 +20,0 @@ "tape": "~0.2.2",

@@ -5,2 +5,4 @@ # level-sublevel

[![build status](https://secure.travis-ci.org/dominictarr/level-sublevel.png)](http://travis-ci.org/dominictarr/level-sublevel)
This module allows you to create seperate sections of a

@@ -7,0 +9,0 @@ [levelup](https://github.com/rvagg/node-levelup) database,

var test = require('tape')
function all (db, cb) {
var obj = {}, fin = false
function done (err) {
if(fin) return
fin = true
cb(err, obj)
}
db.createReadStream({end: '\xff\xff'})
.on('data', function (ch) {
obj[ch.key] = ch.value
})
.on('end', done)
.on('error', done)
}
test('sublevel - batch', function (t) {
require('rimraf').sync('/tmp/test-sublevel')
var base = require('levelup')('/tmp/test-sublevel')
var base = require('level')('/tmp/test-sublevel')

@@ -16,3 +33,2 @@ var Sublevel = require('../')

var keys = ''
var sum = 0

@@ -27,12 +43,12 @@

], function (err) {
a.createReadStream()
.on('data', function (ch) {
keys += ch.key
sum += Number(ch.value)
})
.on('end', function () {
t.equal(keys, 'abcde')
t.equal(sum, 15)
t.end()
})
all(a, function (err, obj) {
t.notOk(err)
var keys = Object.keys(obj).join('')
for(var k in obj) {
sum += Number(obj[k])
}
t.equal(keys, 'abcde')
t.equal(sum, 15)
t.end()
})
})

@@ -45,3 +61,3 @@

require('rimraf').sync('/tmp/test-sublevel2')
var base = require('levelup')('/tmp/test-sublevel2')
var base = require('level')('/tmp/test-sublevel2')

@@ -55,4 +71,2 @@ var Sublevel = require('../')

var obj = {}
base.batch([

@@ -65,19 +79,14 @@ {key: 'a', value: 1, type: 'put'},

], function (err) {
base.createReadStream({end: '\xff\xff'})
.on('data', function (ch) {
obj[ch.key] = ch.value
all(base, function (_, obj) {
t.deepEqual(obj, {
'a': '1',
'c': '3',
'e': '5',
'~A~d': '4',
'~B~b': '2'
})
.on('end', function () {
t.deepEqual(obj, {
'a': '1',
'c': '3',
'e': '5',
'~A~d': '4',
'~B~b': '2'
})
console.log(obj)
t.end()
})
console.log(obj)
t.end()
})
})
})

@@ -88,3 +97,3 @@

require('rimraf').sync('/tmp/test-sublevel3')
var base = require('levelup')('/tmp/test-sublevel3')
var base = require('level')('/tmp/test-sublevel3')

@@ -98,4 +107,2 @@ var Sublevel = require('../')

var obj = {}
a.batch([

@@ -108,17 +115,12 @@ {key: 'a', value: 1, type: 'put', prefix: base},

], function (err) {
base.createReadStream({end: '\xff\xff'})
.on('data', function (ch) {
obj[ch.key] = ch.value
all(base, function (_, obj) {
t.deepEqual(obj, {
'a': '1',
'c': '3',
'e': '5',
'~A~d': '4',
'~B~b': '2'
})
.on('end', function () {
t.deepEqual(obj, {
'a': '1',
'c': '3',
'e': '5',
'~A~d': '4',
'~B~b': '2'
})
console.log(obj)
t.end()
})
t.end()
})
})

@@ -131,3 +133,3 @@ })

require('rimraf').sync('/tmp/test-sublevel4')
var base = require('levelup')('/tmp/test-sublevel4')
var base = require('level')('/tmp/test-sublevel4')

@@ -142,31 +144,24 @@ var Sublevel = require('../')

var obj = {}
a.batch([
{key: 'a', value: 1, type: 'put', prefix: base.prefix()},
base.batch([
{key: 'a', value: 1, type: 'put'},
{key: 'b', value: 2, type: 'put', prefix: b.prefix()},
{key: 'c', value: 3, type: 'put', prefix: base.prefix()},
{key: 'd', value: 4, type: 'put'},
{key: 'e', value: 5, type: 'put', prefix: base.prefix()},
{key: 'c', value: 3, type: 'put'},
{key: 'd', value: 4, type: 'put', prefix: a.prefix()},
{key: 'e', value: 5, type: 'put'},
{key: 'f', value: 6, type: 'put', prefix: b_c.prefix()},
], function (err) {
base.createReadStream({end: '\xff\xff'})
.on('data', function (ch) {
obj[ch.key] = ch.value
all(base, function (_, obj) {
t.deepEqual(obj, {
'a': '1',
'c': '3',
'e': '5',
'~A~d': '4',
'~B~b': '2',
'~B~~C~f': '6'
})
.on('end', function () {
console.log('D?', obj)
t.deepEqual(obj, {
'a': '1',
'c': '3',
'e': '5',
'~A~d': '4',
'~B~b': '2',
'~B~~C~f': '6'
})
console.log(obj)
t.end()
})
console.log(obj)
t.end()
})
})
})

@@ -6,3 +6,3 @@

var base = require('levelup')('/tmp/test-sublevel', function () {
var base = require('level')('/tmp/test-sublevel', function () {
var Sublevel = require('../')

@@ -9,0 +9,0 @@

@@ -6,3 +6,3 @@

var base = require('levelup')('/tmp/test-sublevel', function () {
var base = require('level')('/tmp/test-sublevel', function () {
var Sublevel = require('../')

@@ -41,4 +41,2 @@

return
function all(db, cb) {

@@ -45,0 +43,0 @@ var o = {}

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

require('rimraf').sync('/tmp/test-sublevel')
var base = SubLevel(require('levelup')('/tmp/test-sublevel'))
var base = SubLevel(require('level')('/tmp/test-sublevel'))

@@ -38,3 +38,3 @@ var lc = [], uc = []

require('rimraf').sync('/tmp/test-sublevel')
var db = SubLevel(require('levelup')('/tmp/test-sublevel2'))
var db = SubLevel(require('level')('/tmp/test-sublevel2'))
var base = db.sublevel('stuff')

@@ -41,0 +41,0 @@

@@ -7,3 +7,3 @@ var Sublevel = require('../')

var base = Sublevel(require('levelup')('/tmp/test-sublevel'))
var base = Sublevel(require('level')('/tmp/test-sublevel'))

@@ -42,3 +42,3 @@ Sublevel(base, '~')

var base = Sublevel(require('levelup')('/tmp/test-sublevel2'))
var base = Sublevel(require('level')('/tmp/test-sublevel2'))

@@ -45,0 +45,0 @@ Sublevel(base, '~')

"use strict";
var test = require('tape')
var LevelUp = require('levelup');
var LevelUp = require('level');
var Sublevel = require('../');

@@ -6,0 +6,0 @@ var timestamp = require('monotonic-timestamp')

@@ -118,3 +118,3 @@ var test = require('tape')

var base = require('../')
(require('levelup')('/tmp/test-sublevel-reverse'))
(require('level')('/tmp/test-sublevel-reverse'))
var A = base.sublevel('A')

@@ -121,0 +121,0 @@ makeTest(base, 'simple')

@@ -6,3 +6,3 @@

var base = require('levelup')('/tmp/test-sublevel-readstream', function () {
var base = require('level')('/tmp/test-sublevel-readstream', function () {
var Sublevel = require('../')

@@ -9,0 +9,0 @@

require('rimraf').sync('/tmp/test-sublevels')
var levelup = require('levelup')
var levelup = require('level')

@@ -4,0 +4,0 @@ var base = require('../')(levelup('/tmp/test-sublevels'))

Sorry, the diff of this file is not supported yet

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