level-sublevel
Advanced tools
Comparing version 6.3.4 to 6.3.6
15
nut.js
@@ -149,2 +149,3 @@ var hooks = require('./hooks') | ||
function encodeKey(key) { | ||
console.log("ENCODE", prefix, key) | ||
return encodePrefix(prefix, key, opts, {}) | ||
@@ -155,3 +156,3 @@ } | ||
if(opts.start || opts.end) { | ||
if(has(opts, 'start') || has(opts, 'end')) { | ||
if(opts.reverse) { | ||
@@ -167,9 +168,9 @@ opts.lte = encodeKey(opts.start || upper) | ||
} else { | ||
if(opts.min) opts.gte = opts.min | ||
if(opts.max) opts.lte = opts.max | ||
if(has(opts, 'min')) opts.gte = opts.min | ||
if(has(opts, 'max')) opts.lte = opts.max | ||
if(opts.lte) opts.lte = encodeKey(opts.lte) | ||
if(opts.lt) opts.lt = encodeKey(opts.lt) | ||
if(opts.gt) opts.gt = encodeKey(opts.gt) | ||
if(opts.gte) opts.gte = encodeKey(opts.gte) | ||
if(has(opts, 'lte')) opts.lte = encodeKey(opts.lte) | ||
if(has(opts, 'lt')) opts.lt = encodeKey(opts.lt) | ||
if(has(opts, 'gt')) opts.gt = encodeKey(opts.gt) | ||
if(has(opts, 'gte')) opts.gte = encodeKey(opts.gte) | ||
} | ||
@@ -176,0 +177,0 @@ |
{ | ||
"name": "level-sublevel", | ||
"description": "partition levelup databases", | ||
"version": "6.3.4", | ||
"version": "6.3.6", | ||
"homepage": "https://github.com/dominictarr/level-sublevel", | ||
@@ -25,3 +25,3 @@ "repository": { | ||
"stream-to-pull-stream": "~1.2.0", | ||
"tape": "~2.13.3", | ||
"tape": "~2.14.0", | ||
"through": "~2.3.4", | ||
@@ -28,0 +28,0 @@ "leveldown": "~0.10.2" |
@@ -19,6 +19,10 @@ # level-sublevel | ||
So it's good to use it with a new project, | ||
The user api is the same as before, | ||
The user api is _mostly_ the same as before, | ||
but the way that keys are _encoded_ has changed, and _this means | ||
you cannot run 6 on a database you created with 5_. | ||
Also, `createWriteStream` has been removed, in anticipation of [this | ||
change](https://github.com/rvagg/node-levelup/pull/207) use something | ||
like [level-write-stream](https://github.com/Raynos/level-write-stream) | ||
### Legacy Mode | ||
@@ -25,0 +29,0 @@ |
var tape = require('tape') | ||
var sublevel = require('../') | ||
var sublevel = require('../bytewise') | ||
var level = require('level-test')() | ||
@@ -9,2 +9,6 @@ | ||
var names = [ | ||
'zero', 'null', 'false', 'emptystring' | ||
] | ||
var db = sublevel( | ||
@@ -16,4 +20,2 @@ level('level-sublevel-falsey', {valueEncoding: 'json'}) | ||
tape('allow falsey value:' + JSON.stringify(falsey), | ||
@@ -30,3 +32,19 @@ function (t) { | ||
}) | ||
tape('allow falsey value in key', function (t) { | ||
var sdb = db.sublevel(names[i]) | ||
sdb.put(falsey, {index: i}, function (err) { | ||
if(err) throw err | ||
sdb.createReadStream({gte: falsey}) | ||
//this will error if the stream returns more than one item | ||
//which it shouldn't. | ||
.on('data', function (op) { | ||
t.equal(op.key, falsey) | ||
t.deepEqual(op.value, {index: i}) | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
}) | ||
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
144048
2263
135