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

deferred-leveldown

Package Overview
Dependencies
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deferred-leveldown - npm Package Compare versions

Comparing version 2.0.3 to 3.0.0

CHANGELOG.md

32

deferred-leveldown.js
var util = require('util')
var AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN
var DeferredIterator = require('./deferred-iterator')
var deferrables = 'put get del batch approximateSize'.split(' ')
var deferrables = 'put get del batch'.split(' ')

@@ -11,2 +11,3 @@ function DeferredLevelDOWN (db) {

this._iterators = []
closed(this)
}

@@ -45,17 +46,30 @@

function open (obj) {
function open (self) {
deferrables.concat('iterator').forEach(function (m) {
obj['_' + m] = function () {
self['_' + m] = function () {
return this._db[m].apply(this._db, arguments)
}
})
if (self._db.approximateSize) {
self.approximateSize = function () {
return this._db.approximateSize.apply(this._db, arguments)
}
}
}
function closed (obj) {
function closed (self) {
deferrables.forEach(function (m) {
obj['_' + m] = function () {
self['_' + m] = function () {
this._operations.push({ method: m, args: arguments })
}
})
obj._iterator = function (options) {
if (typeof self._db.approximateSize === 'function') {
self.approximateSize = function () {
this._operations.push({
method: 'approximateSize',
args: arguments
})
}
}
self._iterator = function (options) {
var it = new DeferredIterator(options)

@@ -67,8 +81,2 @@ this._iterators.push(it)

closed(DeferredLevelDOWN.prototype)
DeferredLevelDOWN.prototype._isBuffer = function (obj) {
return Buffer.isBuffer(obj)
}
DeferredLevelDOWN.prototype._serializeKey = function (key) {

@@ -75,0 +83,0 @@ return key

The MIT License (MIT)
=====================
Copyright (c) 2013-2017 Rod Vagg
Copyright (c) 2013-2018 Rod Vagg
---------------------------

@@ -6,0 +6,0 @@

{
"name": "deferred-leveldown",
"description": "For handling delayed-open on LevelDOWN compatible libraries",
"version": "2.0.3",
"version": "3.0.0",
"contributors": [

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

"dependencies": {
"abstract-leveldown": "~3.0.0"
"abstract-leveldown": "~4.0.0"
},

@@ -36,0 +36,0 @@ "devDependencies": {

@@ -34,5 +34,6 @@ # deferred-leveldown

Contributing
------------
**If you are upgrading:** please see [UPGRADING.md](UPGRADING.md).
## Contributing
`deferred-leveldown` is an **OPEN Open Source Project**. This means that:

@@ -42,3 +43,3 @@

See the [CONTRIBUTING.md](https://github.com/Level/levelup/blob/master/CONTRIBUTING.md) file for more details.
See the [CONTRIBUTING.md](https://github.com/Level/community/blob/master/CONTRIBUTING.md) file for more details.

@@ -65,10 +66,8 @@ ### Contributors

<a name="license"></a>
License &amp; copyright
-------------------
## License
Copyright (c) 2013-2017 `deferred-leveldown` contributors (listed above).
Copyright (c) 2013-2018 `deferred-leveldown` contributors (listed above).
`deferred-leveldown` is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
`deferred-leveldown` is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included [LICENSE.md](LICENSE.md) file for more details.
[level-badge]: http://leveldb.org/img/badge.svg

@@ -235,2 +235,10 @@ var test = require('tape')

})
t.test('store not supporting approximateSize', function (t) {
var ld = Db('FOO', function () {})
t.throws(function () {
ld.approximateSize('key', 'key', noop)
}, /approximateSize is not a function/)
t.end()
})
})

@@ -237,0 +245,0 @@

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