Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit 2a2780c

Browse files
committed
refactor ltgt encoding
1 parent 681c6ce commit 2a2780c

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

lib/levelup.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -351,24 +351,13 @@ LevelUP.prototype.createReadStream = function (options) {
351351
options.keyEncoding = options.keyEncoding
352352
options.valueEncoding = options.valueEncoding
353353

354-
if (isDefined(options.start))
355-
options.start = this._codec.encodeKey(options.start, [options])
356-
if (isDefined(options.end))
357-
options.end = this._codec.encodeKey(options.end, [options])
358-
if (isDefined(options.gte))
359-
options.gte = this._codec.encodeKey(options.gte, [options])
360-
if (isDefined(options.gt))
361-
options.gt = this._codec.encodeKey(options.gt, [options])
362-
if (isDefined(options.lte))
363-
options.lte = this._codec.encodeKey(options.lte, [options])
364-
if (isDefined(options.lt))
365-
options.lt = this._codec.encodeKey(options.lt, [options])
366-
if ('number' !== typeof options.limit)
367-
options.limit = -1
368-
354+
options = this._codec.encodeLtgt(options);
369355
options.keyAsBuffer = this._codec.keyAsBuffer([options])
370356
options.valueAsBuffer = this._codec.valueAsBuffer([options])
371357

358+
if ('number' !== typeof options.limit)
359+
options.limit = -1
360+
372361
var makeData = options.keys && options.values
373362
? function (key, value) {
374363
return {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"main": "lib/levelup.js",
3636
"dependencies": {
3737
"deferred-leveldown": "^0.3.0",
38-
"level-codec": "^5.0.0",
38+
"level-codec": "^5.4.0",
3939
"level-errors": "~1.0.3",
4040
"prr": "~0.0.0",
4141
"readable-stream": "~1.0.26",

0 commit comments

Comments
 (0)