Skip to content

Commit

Permalink
Make internal iterator decoding options enumerable
Browse files Browse the repository at this point in the history
Otherwise they're lost when an implementation clones options.
  • Loading branch information
vweevers committed Mar 20, 2022
1 parent 90b8816 commit eb08363
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions abstract-level.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,8 @@ class AbstractLevel extends EventEmitter {
options.values = options.values !== false

// We need the original encoding options in AbstractIterator in order to decode data
Object.defineProperty(options, AbstractIterator.keyEncoding, { value: keyEncoding })
Object.defineProperty(options, AbstractIterator.valueEncoding, { value: valueEncoding })
options[AbstractIterator.keyEncoding] = keyEncoding
options[AbstractIterator.valueEncoding] = valueEncoding

// Forward encoding options to private API
options.keyEncoding = keyEncoding.format
Expand Down Expand Up @@ -684,8 +684,8 @@ class AbstractLevel extends EventEmitter {
options = rangeOptions(options, keyEncoding)

// We need the original encoding options in AbstractKeyIterator in order to decode data
Object.defineProperty(options, AbstractIterator.keyEncoding, { value: keyEncoding })
Object.defineProperty(options, AbstractIterator.valueEncoding, { value: valueEncoding })
options[AbstractIterator.keyEncoding] = keyEncoding
options[AbstractIterator.valueEncoding] = valueEncoding

// Forward encoding options to private API
options.keyEncoding = keyEncoding.format
Expand Down Expand Up @@ -713,8 +713,8 @@ class AbstractLevel extends EventEmitter {
options = rangeOptions(options, keyEncoding)

// We need the original encoding options in AbstractValueIterator in order to decode data
Object.defineProperty(options, AbstractIterator.keyEncoding, { value: keyEncoding })
Object.defineProperty(options, AbstractIterator.valueEncoding, { value: valueEncoding })
options[AbstractIterator.keyEncoding] = keyEncoding
options[AbstractIterator.valueEncoding] = valueEncoding

// Forward encoding options to private API
options.keyEncoding = keyEncoding.format
Expand Down

0 comments on commit eb08363

Please sign in to comment.