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

Commit 717066e

Browse files
committed
Refactor: use addRestOptions() for iterator
1 parent 0bd41cc commit 717066e

1 file changed

Lines changed: 1 addition & 19 deletions

File tree

leveldown.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -235,30 +235,12 @@ function maybeError (leveldown, callback) {
235235
return false
236236
}
237237

238-
// TODO (refactor): use addRestOptions instead
239-
function extend (xopts, opts) {
240-
xopts.keys = opts.keys
241-
xopts.values = opts.values
242-
xopts.createIfMissing = opts.createIfMissing
243-
xopts.errorIfExists = opts.errorIfExists
244-
xopts.keyEncoding = opts.keyEncoding
245-
xopts.valueEncoding = opts.valueEncoding
246-
xopts.compression = opts.compression
247-
xopts.db = opts.db
248-
xopts.limit = opts.limit
249-
xopts.keyAsBuffer = opts.keyAsBuffer
250-
xopts.valueAsBuffer = opts.valueAsBuffer
251-
xopts.reverse = opts.reverse
252-
xopts.fillCache = opts.fillCache
253-
return xopts
254-
}
255-
256238
function fixRange (opts) {
257239
return (!opts.reverse || (!opts.end && !opts.start)) ? opts : { start: opts.end, end: opts.start }
258240
}
259241

260242
SubDown.prototype._iterator = function (opts) {
261-
const xopts = extend(wrap(fixRange(opts), this._wrap), opts)
243+
const xopts = addRestOptions(wrap(fixRange(opts), this._wrap), opts)
262244
return new SubIterator(this, this.leveldown.iterator(xopts), this.prefix)
263245
}
264246

0 commit comments

Comments
 (0)