Closed vweevers closed 5 years ago
Note that level-js
is currently passing the test suite of abstract-leveldown@5
because abstract-leveldown
used to filter out range options that were a zero-length string or buffer.
Correction: unlike bytewise
, IDB sorts binary after string. For reference, here's a quick test of IDB type order:
They assume that a zero-length string or zero-length Buffer means "not defined". IMO that should be left up to an implementation.
https://github.com/Level/abstract-leveldown/blob/fd64104829e94b0187377d9b8b5d3ee546bb39f2/test/iterator-range-test.js#L313-L345
In
bytewise
,charwise
and IndexedDB, an empty string is a significant type. In all three, the sort order of types is:null
(not supported by IDB)false
(not supported by IDB)true
(not supported by IDB)number
(numeric)date
(numeric, epoch offset)binary
(bitwise) (not supported bycharwise
and IDB First Edition)string
(lexicographic)array
(componentwise)undefined
(not supported by IDB)For example,
charwise
encodes an empty string as'J'
.I suggest:
abstract-leveldown
, document behavior (https://github.com/Level/abstract-leveldown/pull/319) (semver-patch)leveldown
, document the behavior (https://github.com/Level/leveldown/issues/573) (semver-patch or RC, depending on when this lands)level-js
on sort order of the above types, document the behavior (https://github.com/Level/level-js/issues/156) (release as part of upgrade toabstract-leveldown@6
)