Comparing version 0.0.14 to 0.0.15
@@ -583,3 +583,3 @@ const codecs = require('codecs') | ||
let node = await this.getRoot() | ||
if (!node) return | ||
if (!node) return this._unlockMaybe() | ||
@@ -611,3 +611,3 @@ const seq = this.tree.feed.length + this.length | ||
if (!node.children.length) return | ||
if (!node.children.length) return this._unlockMaybe() | ||
@@ -657,2 +657,6 @@ const i = c < 0 ? e : s | ||
_unlockMaybe () { | ||
if (this.autoFlush) this._unlock() | ||
} | ||
_unlock () { | ||
@@ -659,0 +663,0 @@ const locked = this.locked |
@@ -153,3 +153,3 @@ class SubTree { | ||
async next () { | ||
if (this.limit < 0) return null | ||
if (this.limit === 0) return null | ||
const res = await this._next() | ||
@@ -156,0 +156,0 @@ if (!res || (res.left === null && res.right === null)) return null |
{ | ||
"name": "hyperbee", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "An append-only Btree running on a Hypercore.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,2 +7,3 @@ const Hyperbee = require('../../') | ||
createRange, | ||
insertRange, | ||
rangeify, | ||
@@ -35,6 +36,5 @@ collect | ||
async function createRange (start, end, opts = end) { | ||
async function insertRange (db, start, end) { | ||
if (typeof end !== 'number') end = undefined | ||
const db = create(opts) | ||
const b = db.batch() | ||
@@ -44,3 +44,11 @@ for (const r of rangeify(start, end)) { | ||
} | ||
await b.flush() | ||
} | ||
async function createRange (start, end, opts = end) { | ||
if (typeof end !== 'number') end = undefined | ||
const db = create(opts) | ||
await insertRange(db, start, end) | ||
return db | ||
@@ -47,0 +55,0 @@ } |
Sorry, the diff of this file is not supported yet
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
87777
23
2627