abstract-nosql
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -554,4 +554,4 @@ // Generated by CoffeeScript 1.8.0 | ||
options.limit = ("limit" in options ? options.limit : -1); | ||
options.keyAsBuffer = options.keyAsBuffer !== false; | ||
options.valueAsBuffer = options.valueAsBuffer !== false; | ||
options.keyAsBuffer = options.keyAsBuffer === true; | ||
options.valueAsBuffer = options.valueAsBuffer === true; | ||
return options; | ||
@@ -558,0 +558,0 @@ }; |
@@ -125,2 +125,38 @@ var db | ||
if (key && value) { | ||
t.equal(key, data[idx].key, 'correct key') | ||
t.equal(value, data[idx].value, 'correct value') | ||
process.nextTick(next) | ||
idx++ | ||
} else { // end | ||
t.ok(typeof err === 'undefined', 'err argument is undefined') | ||
t.ok(typeof key === 'undefined', 'key argument is undefined') | ||
t.ok(typeof value === 'undefined', 'value argument is undefined') | ||
t.equal(idx, data.length, 'correct number of entries') | ||
iterator.end(function () { | ||
t.end() | ||
}) | ||
} | ||
} | ||
, next = function () { | ||
iterator.next(fn) | ||
} | ||
next() | ||
}) | ||
}) | ||
test('test simple iterator() asBuffer', function (t) { | ||
var data = [ | ||
{ type: 'put', key: 'foobatch1', value: 'bar1' } | ||
, { type: 'put', key: 'foobatch2', value: 'bar2' } | ||
, { type: 'put', key: 'foobatch3', value: 'bar3' } | ||
] | ||
, idx = 0 | ||
db.batch(data, function (err) { | ||
t.error(err) | ||
var iterator = db.iterator({keyAsBuffer: true, valueAsBuffer: true}) | ||
, fn = function (err, key, value) { | ||
t.error(err) | ||
if (key && value) { | ||
t.ok(Buffer.isBuffer(key), 'key argument is a Buffer') | ||
@@ -127,0 +163,0 @@ t.ok(Buffer.isBuffer(value), 'value argument is a Buffer') |
{ | ||
"name": "abstract-nosql", | ||
"description": "An abstract prototype for nosql database(LevelDOWN API)", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ "Riceball LEE <snowyu.lee@gmail.com> (https://github.com/snowyu)", |
@@ -496,3 +496,3 @@ const tap = require('tap') | ||
var spy = sinon.spy() | ||
, expectedOptions = { options: 1, reverse: false, keys: true, values: true, limit: -1, keyAsBuffer: true, valueAsBuffer: true } | ||
, expectedOptions = { options: 1, reverse: false, keys: true, values: true, limit: -1, keyAsBuffer: false, valueAsBuffer: false } | ||
, test | ||
@@ -499,0 +499,0 @@ |
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
168289
3570