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

level-js

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-js - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

65

iterator.js
var util = require('util')
var AbstractIterator = require('abstract-leveldown').AbstractIterator
var ltgt = require('ltgt')
module.exports = Iterator

@@ -10,11 +12,14 @@

this._order = options.reverse ? 'DESC': 'ASC'
this._start = options.start
this._limit = options.limit
this._count = 0
this._end = options.end
this._done = false
this._gt = options.gt
this._gte = options.gte
this._lt = options.lt
this._lte = options.lte
var lower = ltgt.lowerBound(options)
var upper = ltgt.upperBound(options)
this._keyRange = lower || upper ? this.db.makeKeyRange({
lower: lower,
upper: upper,
excludeLower: ltgt.lowerBoundExclusive(options),
excludeUpper: ltgt.upperBoundExclusive(options)
}) : null
this.callback = null
}

@@ -26,43 +31,3 @@

var self = this
var lower, upper
var onlyStart = typeof self._start !== 'undefined' && typeof self._end === 'undefined'
var onlyEnd = typeof self._start === 'undefined' && typeof self._end !== 'undefined'
var startAndEnd = typeof self._start !== 'undefined' && typeof self._end !== 'undefined'
if (onlyStart) {
var index = self._start
if (self._order === 'ASC') {
lower = index
} else {
upper = index
}
} else if (onlyEnd) {
var index = self._end
if (self._order === 'DESC') {
lower = index
} else {
upper = index
}
} else if (startAndEnd) {
lower = self._start
upper = self._end
if (self._start > self._end) {
lower = self._end
upper = self._start
}
}
if (!lower) {
if (self._gte !== 'undefined') lower = self._gte
else if (self._gt !== 'undefined') lower = self._gt
}
if (!upper) {
if (self._lte !== 'undefined') upper = self._lte
else if (self._lt !== 'undefined') upper = self._lt
}
if (lower || upper) {
self._keyRange = self.options.keyRange || self.db.makeKeyRange({
lower: lower,
upper: upper
// TODO expose excludeUpper/excludeLower
})
}
self.iterator = self.db.iterate(function () {

@@ -91,8 +56,2 @@ self.onItem.apply(self, arguments)

if ( (this._lt && cursor.key >= this._lt)
|| (this._lte && cursor.key > this._lte)
|| (this._gt && cursor.key <= this._gt)
|| (this._gte && cursor.key < this._gte))
shouldCall = false
if (shouldCall) this.callback(false, cursor.key, cursor.value)

@@ -99,0 +58,0 @@ if (cursor) cursor.continue()

9

package.json
{
"name": "level-js",
"version": "2.1.4",
"version": "2.1.5",
"description": "leveldown/leveldb library for browsers using IndexedDB",

@@ -25,8 +25,9 @@ "main": "index.js",

"dependencies": {
"abstract-leveldown": "~0.12.0",
"idb-wrapper": "~1.4.1",
"isbuffer": "~0.0.0",
"xtend": "~2.1.2",
"ltgt": "^1.0.1",
"tape": "~2.10.2",
"abstract-leveldown": "~0.12.0",
"typedarray-to-buffer": "~1.0.0"
"typedarray-to-buffer": "~1.0.0",
"xtend": "~2.1.2"
},

@@ -33,0 +34,0 @@ "testling": {

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