Skip to content

Commit

Permalink
memdb/browserdb: deprecate start/end iterator options.
Browse files Browse the repository at this point in the history
  • Loading branch information
nodech committed May 2, 2023
1 parent b66d629 commit 1700468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
10 changes: 2 additions & 8 deletions lib/level-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,6 @@ class IteratorOptions {
this.values = options.values;
}

if (options.start != null)
this.start = options.start;

if (options.end != null)
this.end = options.end;

if (options.gte != null)
this.start = options.gte;

Expand All @@ -633,13 +627,13 @@ class IteratorOptions {
if (this.start != null) {
if (typeof this.start === 'string')
this.start = Buffer.from(this.start, 'utf8');
assert(Buffer.isBuffer(this.start), '`start` must be a Buffer.');
assert(Buffer.isBuffer(this.start), '`gt(e)` must be a Buffer.');
}

if (this.end != null) {
if (typeof this.end === 'string')
this.end = Buffer.from(this.end, 'utf8');
assert(Buffer.isBuffer(this.end), '`end` must be a Buffer.');
assert(Buffer.isBuffer(this.end), '`lt(e)` must be a Buffer.');
}

if (options.keyAsBuffer != null) {
Expand Down
10 changes: 2 additions & 8 deletions lib/memdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,6 @@ class IteratorOptions {
this.values = options.values;
}

if (options.start != null)
this.start = options.start;

if (options.end != null)
this.end = options.end;

if (options.gte != null)
this.start = options.gte;

Expand All @@ -641,13 +635,13 @@ class IteratorOptions {
if (this.start != null) {
if (typeof this.start === 'string')
this.start = Buffer.from(this.start, 'utf8');
assert(Buffer.isBuffer(this.start), '`start` must be a Buffer.');
assert(Buffer.isBuffer(this.start), '`gt(e)` must be a Buffer.');
}

if (this.end != null) {
if (typeof this.end === 'string')
this.end = Buffer.from(this.end, 'utf8');
assert(Buffer.isBuffer(this.end), '`end` must be a Buffer.');
assert(Buffer.isBuffer(this.end), '`lt(e)` must be a Buffer.');
}

if (options.keyAsBuffer != null) {
Expand Down

0 comments on commit 1700468

Please sign in to comment.