Socket
Socket
Sign inDemoInstall

hyperbee

Package Overview
Dependencies
Maintainers
2
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperbee - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

20

index.js

@@ -55,2 +55,11 @@ const codecs = require('codecs')

}
hasKey (seq) {
for (const lvl of this.levels) {
for (const key of lvl.keys) {
if (key.seq === seq) return true
}
}
return false
}
}

@@ -220,2 +229,13 @@

isDeletion () {
if (this.value !== null) return false
if (this.index === null) {
this.index = inflate(this.indexBuffer)
this.indexBuffer = null
}
return !this.index.hasKey(this.seq)
}
final () {

@@ -222,0 +242,0 @@ return {

9

iterators/history.js

@@ -29,9 +29,14 @@ module.exports = class HistoryIterator {

if (this.lt <= 1) return null
return (await this.db.getBlock(--this.lt, this.options)).final()
return final(await this.db.getBlock(--this.lt, this.options))
}
return (await this.db.getBlock(this.gte++, this.options)).final()
return final(await this.db.getBlock(this.gte++, this.options))
}
}
function final (node) {
const type = node.isDeletion() ? 'del' : 'put'
return { type, ...node.final() }
}
function gte (opts, version) {

@@ -38,0 +43,0 @@ if (opts.gt) return (opts.gt < 0 ? (opts.gt + version) : opts.gt) + 1

{
"name": "hyperbee",
"version": "1.4.0",
"version": "1.5.0",
"description": "An append-only Btree running on a Hypercore.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -124,2 +124,3 @@ # Hyperbee 🐝

Create a stream of all entries ever inserted or deleted from the db.
Each entry has an additional `type` property indicating if it was a `put` or `del` operation.

@@ -126,0 +127,0 @@ Options include:

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