Socket
Socket
Sign inDemoInstall

abstract-leveldown

Package Overview
Dependencies
Maintainers
3
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-leveldown - npm Package Compare versions

Comparing version 2.3.1 to 2.4.0

43

abstract-leveldown.js

@@ -15,5 +15,9 @@ /* Copyright (c) 2013 Rod Vagg, MIT License */

this.location = location
this.status = 'new'
}
AbstractLevelDOWN.prototype.open = function (options, callback) {
var self = this
, oldStatus = this.status
if (typeof options == 'function')

@@ -31,16 +35,39 @@ callback = options

if (typeof this._open == 'function')
return this._open(options, callback)
process.nextTick(callback)
if (typeof this._open == 'function') {
this.status = 'opening'
this._open(options, function (err) {
if (err) {
self.status = oldStatus
return callback(err)
}
self.status = 'open'
callback()
})
} else {
this.status = 'open'
process.nextTick(callback)
}
}
AbstractLevelDOWN.prototype.close = function (callback) {
var self = this
, oldStatus = this.status
if (typeof callback != 'function')
throw new Error('close() requires a callback argument')
if (typeof this._close == 'function')
return this._close(callback)
process.nextTick(callback)
if (typeof this._close == 'function') {
this.status = 'closing'
this._close(function (err) {
if (err) {
self.status = oldStatus
return callback(err)
}
self.status = 'closed'
callback()
})
} else {
this.status = 'closed'
process.nextTick(callback)
}
}

@@ -47,0 +74,0 @@

@@ -0,1 +1,68 @@

### 2.3.1 - May 18 2015
* [[`393c781629`](https://github.com/level/abstract-leveldown/commit/393c781629)] - document isLevelDown() (Lars-Magnus Skog)
* [[`fd899c49b9`](https://github.com/level/abstract-leveldown/commit/fd899c49b9)] - link to level/community (Lars-Magnus Skog)
### 2.3.0 - May 18 2015
* [[`9a976428e2`](https://github.com/level/abstract-leveldown/commit/9a976428e2)] - export from index.js and factor out into is-leveldown.js (Lars-Magnus Skog)
* [[`8051f8f16c`](https://github.com/level/abstract-leveldown/commit/8051f8f16c)] - add isLevelDOWN() f
unction (Lars-Magnus Skog)
### 2.2.2 - May 13 2015
* [[`4ff0a9bfbb`](https://github.com/level/abstract-leveldown/commit/4ff0a9bfbb)] - ***Revert*** "Merge pull request #60 from ralphtheninja/empty-location" (Julian Gruber)
* [[`fab11e9e3b`](https://github.com/level/abstract-leveldown/commit/fab11e9e3b)] - use t.equal instead of t.ok(a === b) (Julian Gruber)
### 2.2.1 - May 12 2015
* [[`f5051090e4`](https://github.com/level/abstract-leveldown/commit/f5051090e4)] - merge location string checks into one if-statement (Lars-Magnus Skog)
* [[`cd362b2b9f`](https://github.com/level/abstract-leveldown/commit/cd362b2b9f)] - empty location string throws (Lars-Magnus Skog)
* [[`e6d1cb80ea`](https://github.com/level/abstract-leveldown/commit/e6d1cb80ea)] - .throws is different for tape (Lars-Magnus Skog)
* [[`a6f29b62fa`](https://github.com/level/abstract-leveldown/commit/a6f29b62fa)] - copy paste error gave wrong test description (Lars-Magnus Skog)
### 2.2.0 - May 10 2015
* [[`aa867b3760`](https://github.com/level/abstract-leveldown/commit/aa867b3760)] - Merge pull request #58 from Level/add/put-sync (Julian Gruber)
* [[`234de997bb`](https://github.com/level/abstract-leveldown/commit/234de997bb)] - add sync put tests (Julian Gruber)
### 2.1.4 - Apr 28 2015
* [[`969116d00f`](https://github.com/level/abstract-leveldown/commit/969116d00f)] - use t.equal() with tape (Lars-Magnus Skog)
### 2.1.3 - Apr 28 2015
* [[`68096e78cd`](https://github.com/level/abstract-leveldown/commit/68096e78cd)] - change from tap to tape (Lars-Magnus Skog)
### 2.1.2 - Apr 27 2015
* [[`d79c060c9d`](https://github.com/level/abstract-leveldown/commit/d79c060c9d)] - convert buffer to string so we can compare (Lars-Magnus Skog)
### 2.1.1 - Apr 27 2015
* [[`3881fc4290`](https://github.com/level/abstract-leveldown/commit/3881fc4290)] - **travis**: update npm so 0.8 works, add 0.12 and iojs (Lars-Magnus Skog)
* [[`9f451e8f74`](https://github.com/level/abstract-leveldown/commit/9f451e8f74)] - rvagg/node- -> level/ (Lars-Magnus Skog)
* [[`ecd41a72db`](https://github.com/level/abstract-leveldown/commit/ecd41a72db)] - fix typo (Hao-kang Den)
* [[`20e91fd234`](https://github.com/level/abstract-leveldown/commit/20e91fd234)] - update logo and copyright (Lars-Magnus Skog)
* [[`6ccf134874`](https://github.com/level/abstract-leveldown/commit/6ccf134874)] - added @watson to package.json (Rod Vagg)
### 2.1.0 - Nov 9 2014
* [[`7451cd15e6`](https://github.com/level/abstract-leveldown/commit/7451cd15e6)] - added @watson (Rod Vagg)
* [[`f4a3346da7`](https://github.com/level/abstract-leveldown/commit/f4a3346da7)] - Use `error` test function when testing for errors (Thomas Watson Steen)
* [[`24668c50e0`](https://github.com/level/abstract-leveldown/commit/24668c50e0)] - Don't fail if no value is returned by _get (Thomas Watson Steen)
* [[`865ed9e777`](https://github.com/level/abstract-leveldown/commit/865ed9e777)] - Use `setTimeout` instead of `setImmediate`. (Alan Gutierrez)
* [[`9e9069faed`](https://github.com/level/abstract-leveldown/commit/9e9069faed)] - 2.0.3 (Rod Vagg)
### 2.0.3 - Oct 2 2014
* [[`78052c53eb`](https://github.com/level/abstract-leveldown/commit/78052c53eb)] - add test for atomic batch operations (Calvin Metcalf)
### 2.0.1 - Sep 1 2014
* [[`a0b36f6a18`](https://github.com/level/abstract-leveldown/commit/a0b36f6a18)] - Remove default options that's too LevelDOWN specific (Thomas Watson Steen)
* [[`1d97993d0b`](https://github.com/level/abstract-leveldown/commit/1d97993d0b)] - Allow boolean options to be falsy/truthy (Thomas Watson Steen)
* [[`fb3cf56da5`](https://github.com/level/abstract-leveldown/commit/fb3cf56da5)] - Set defaults for open, get, put, del and batch options (Thomas Watson Steen)
* [[`5c2a629e2b`](https://github.com/level/abstract-leveldown/commit/5c2a629e2b)] - Update pattern for setting default options for the iterator (Thomas Watson Steen)
### 2.0.0 - Aug 26 2014

@@ -2,0 +69,0 @@ * Lots of stuff between 0.11.1 and now, omitted updating changelog

2

package.json
{
"name": "abstract-leveldown",
"description": "An abstract prototype matching the LevelDOWN API",
"version": "2.3.1",
"version": "2.4.0",
"contributors": [

@@ -6,0 +6,0 @@ "Rod Vagg <r@va.gg> (https://github.com/rvagg)",

@@ -86,3 +86,2 @@ const test = require('tape')

t.deepEqual(spy.getCall(0).args[0], expectedOptions, 'got default options argument')
t.equal(spy.getCall(0).args[1], expectedCb, 'got expected cb argument')

@@ -97,3 +96,2 @@ test.open({ options: 1 }, expectedCb)

t.deepEqual(spy.getCall(1).args[0], expectedOptions, 'got expected options argument')
t.equal(spy.getCall(1).args[1], expectedCb, 'got expected cb argument')
t.end()

@@ -121,3 +119,2 @@ })

t.equal(spy.getCall(0).args.length, 1, 'got one arguments')
t.equal(spy.getCall(0).args[0], expectedCb, 'got expected cb argument')
t.end()

@@ -604,1 +601,118 @@ })

})
test('.status', function (t) {
t.test('empty prototype', function (t) {
var test
function Test (location) {
AbstractLevelDOWN.call(this, location)
}
util.inherits(Test, AbstractLevelDOWN)
test = new Test('foobar')
t.equal(test.status, 'new')
test.open(function (err) {
t.error(err)
t.equal(test.status, 'open')
test.close(function (err) {
t.error(err)
t.equal(test.status, 'closed')
t.end()
})
})
})
t.test('open error', function (t) {
var test
function Test (location) {
AbstractLevelDOWN.call(this, location)
}
util.inherits(Test, AbstractLevelDOWN)
Test.prototype._open = function (options, cb) {
cb(new Error)
}
test = new Test('foobar')
test.open(function (err) {
t.ok(err)
t.equal(test.status, 'new')
t.end()
})
})
t.test('close error', function (t) {
var test
function Test (location) {
AbstractLevelDOWN.call(this, location)
}
util.inherits(Test, AbstractLevelDOWN)
Test.prototype._close = function (cb) {
cb(new Error)
}
test = new Test('foobar')
test.open(function () {
test.close(function (err) {
t.ok(err)
t.equal(test.status, 'open')
t.end()
})
})
})
t.test('open', function (t) {
var test
function Test (location) {
AbstractLevelDOWN.call(this, location)
}
util.inherits(Test, AbstractLevelDOWN)
Test.prototype._open = function (options, cb) {
process.nextTick(cb)
}
test = new Test('foobar')
test.open(function (err) {
t.error(err)
t.equal(test.status, 'open')
t.end()
})
t.equal(test.status, 'opening')
})
t.test('close', function (t) {
var test
function Test (location) {
AbstractLevelDOWN.call(this, location)
}
util.inherits(Test, AbstractLevelDOWN)
Test.prototype._close = function (cb) {
process.nextTick(cb)
}
test = new Test('foobar')
test.open(function (err) {
t.error(err)
test.close(function (err) {
t.error(err)
t.equal(test.status, 'closed')
t.end()
})
t.equal(test.status, 'closing')
})
})
})
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