From 717066ec5e2f2b218271f4d56af3a32a800c980f Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 25 Sep 2021 19:48:19 +0200 Subject: [PATCH] Refactor: use `addRestOptions()` for iterator --- leveldown.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/leveldown.js b/leveldown.js index e9b2755..a7964db 100644 --- a/leveldown.js +++ b/leveldown.js @@ -235,30 +235,12 @@ function maybeError (leveldown, callback) { return false } -// TODO (refactor): use addRestOptions instead -function extend (xopts, opts) { - xopts.keys = opts.keys - xopts.values = opts.values - xopts.createIfMissing = opts.createIfMissing - xopts.errorIfExists = opts.errorIfExists - xopts.keyEncoding = opts.keyEncoding - xopts.valueEncoding = opts.valueEncoding - xopts.compression = opts.compression - xopts.db = opts.db - xopts.limit = opts.limit - xopts.keyAsBuffer = opts.keyAsBuffer - xopts.valueAsBuffer = opts.valueAsBuffer - xopts.reverse = opts.reverse - xopts.fillCache = opts.fillCache - return xopts -} - function fixRange (opts) { return (!opts.reverse || (!opts.end && !opts.start)) ? opts : { start: opts.end, end: opts.start } } SubDown.prototype._iterator = function (opts) { - const xopts = extend(wrap(fixRange(opts), this._wrap), opts) + const xopts = addRestOptions(wrap(fixRange(opts), this._wrap), opts) return new SubIterator(this, this.leveldown.iterator(xopts), this.prefix) }