abstract-leveldown
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -27,2 +27,5 @@ /* Copyright (c) 2013 Rod Vagg, MIT License */ | ||
options.createIfMissing = options.createIfMissing != false | ||
options.errorIfExists = !!options.errorIfExists | ||
if (typeof this._open == 'function') | ||
@@ -62,2 +65,4 @@ return this._open(options, callback) | ||
options.asBuffer = options.asBuffer != false | ||
if (typeof this._get == 'function') | ||
@@ -201,8 +206,7 @@ return this._get(key, options, callback) | ||
options.reverse = !!options.reverse | ||
options.keys = 'keys' in options ? !!options.keys : true | ||
options.values = 'values' in options ? !!options.values : true | ||
options.keys = options.keys != false | ||
options.values = options.values != false | ||
options.limit = 'limit' in options ? options.limit : -1 | ||
options.fillCache = !!options.fillCache | ||
options.keyAsBuffer = 'keyAsBuffer' in options ? !!options.keyAsBuffer : true | ||
options.valueAsBuffer = 'valueAsBuffer' in options ? !!options.valueAsBuffer : true | ||
options.keyAsBuffer = options.keyAsBuffer != false | ||
options.valueAsBuffer = options.valueAsBuffer != false | ||
@@ -209,0 +213,0 @@ return options |
@@ -0,1 +1,5 @@ | ||
### 2.0.0 - Aug 26 2014 | ||
* Lots of stuff between 0.11.1 and now, omitted updating changelog | ||
* Switch to allowing writes of empty values: null, undefined, '', [] | ||
### 0.11.1 - Nov 15 2013 | ||
@@ -2,0 +6,0 @@ * Adjust approximate-size-test.js to account for snappy compression |
{ | ||
"name": "abstract-leveldown", | ||
"description": "An abstract prototype matching the LevelDOWN API", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ "Rod Vagg <r@va.gg> (https://github.com/rvagg)", |
24
test.js
@@ -67,3 +67,3 @@ const tap = require('tap') | ||
, expectedCb = function () {} | ||
, expectedOptions = { options: 1 } | ||
, expectedOptions = { createIfMissing: true, errorIfExists: false } | ||
, test | ||
@@ -85,11 +85,13 @@ | ||
t.equal(spy.getCall(0).args.length, 2, 'got two arguments') | ||
t.deepEqual(spy.getCall(0).args[0], {}, 'got blank options argument') | ||
t.deepEqual(spy.getCall(0).args[0], expectedOptions, 'got default options argument') | ||
t.equal(spy.getCall(0).args[1], expectedCb, 'got expected cb argument') | ||
test.open(expectedOptions, expectedCb) | ||
test.open({ options: 1 }, expectedCb) | ||
expectedOptions.options = 1 | ||
t.equal(spy.callCount, 2, 'got _open() call') | ||
t.equal(spy.getCall(1).thisValue, test, '`this` on _open() was correct') | ||
t.equal(spy.getCall(1).args.length, 2, 'got two arguments') | ||
t.deepEqual(spy.getCall(1).args[0], expectedOptions, 'got blank options argument') | ||
t.deepEqual(spy.getCall(1).args[0], expectedOptions, 'got expected options argument') | ||
t.equal(spy.getCall(1).args[1], expectedCb, 'got expected cb argument') | ||
@@ -125,3 +127,3 @@ t.end() | ||
, expectedCb = function () {} | ||
, expectedOptions = { options: 1 } | ||
, expectedOptions = { asBuffer: true } | ||
, expectedKey = 'a key' | ||
@@ -145,7 +147,9 @@ , test | ||
t.equal(spy.getCall(0).args[0], expectedKey, 'got expected key argument') | ||
t.deepEqual(spy.getCall(0).args[1], {}, 'got blank options argument') | ||
t.deepEqual(spy.getCall(0).args[1], expectedOptions, 'got default options argument') | ||
t.equal(spy.getCall(0).args[2], expectedCb, 'got expected cb argument') | ||
test.get(expectedKey, expectedOptions, expectedCb) | ||
test.get(expectedKey, { options: 1 }, expectedCb) | ||
expectedOptions.options = 1 | ||
t.equal(spy.callCount, 2, 'got _get() call') | ||
@@ -155,3 +159,3 @@ t.equal(spy.getCall(1).thisValue, test, '`this` on _get() was correct') | ||
t.equal(spy.getCall(1).args[0], expectedKey, 'got expected key argument') | ||
t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got blank options argument') | ||
t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got expected options argument') | ||
t.equal(spy.getCall(1).args[2], expectedCb, 'got expected cb argument') | ||
@@ -192,3 +196,3 @@ t.end() | ||
t.equal(spy.getCall(1).args[0], expectedKey, 'got expected key argument') | ||
t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got blank options argument') | ||
t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got expected options argument') | ||
t.equal(spy.getCall(1).args[2], expectedCb, 'got expected cb argument') | ||
@@ -492,3 +496,3 @@ t.end() | ||
var spy = sinon.spy() | ||
, expectedOptions = { options: 1, reverse: false, keys: true, values: true, limit: -1, fillCache: false, keyAsBuffer: true, valueAsBuffer: true } | ||
, expectedOptions = { options: 1, reverse: false, keys: true, values: true, limit: -1, keyAsBuffer: true, valueAsBuffer: true } | ||
, test | ||
@@ -495,0 +499,0 @@ |
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
114354
2615