level-fix-range
make using levelup reverse ranges easy
Last updated 14 years ago by dominictarr .
MIT · Repository · Original npm · Tarball · package.json
$ npm install level-fix-range 
SYNC missed versions from official npm registry.

level-fix-range

make reverse ranges easier to use.

Stability

Stable: Expect patches, possible features additions.

Example

When you use reverse ranges, you have to reverse the start and end also,

db.createReadStream({start: 'a', end: 'z'})
db.createReadStream({start: 'z', end: 'a', reverse: true})

this is confusing and bug-ridden.

level-fix-range fixes the options so they always make sense. if you want a range to reverse, just set reverse.

var fix = require('level-fix-range')
db.createReadStream({start: 'a', end: 'z'})
db.createReadStream(fix({start: 'a', end: 'z', reverse: true}))

When you either start OR end, and the order is reversed: true, it will also reverse the range, so that:

{start: X, end: null} //from X to end of database
{start: null, end: X} //from start of database to X

and you will get the some data, whether you have reverse=true|false, but only the order will change.

License

MIT

Current Tags

  • 2.0.0                                ...           latest (13 years ago)

9 Versions

  • 2.0.0                                ...           13 years ago
  • 1.1.4                                ...           13 years ago
  • 1.1.3                                ...           13 years ago
  • 1.1.2                                ...           14 years ago
  • 1.1.1                                ...           14 years ago
  • 1.1.0                                ...           14 years ago
  • 1.0.2                                ...           14 years ago
  • 1.0.1                                ...           14 years ago
  • 1.0.0                                ...           14 years ago
Maintainers (1)
Downloads
Total 18
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 9
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE