Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
generate and parse string key-ranges (for use with levelup)
branch: master
Failed to load latest commit information.
examples
test explicit, simple range tests for empty groups
.gitignore
.travis.yml
LICENSE
README.md README++
index.js remove logging
package.json

README.md

range-bucket

Generate string ranges that group into ranges, suitable for use as database keys (recommended for levelup)

var bucket = require('range-bucket')
//will create buckets that are prefixed with BUCKET.
var b = bucket('BUCKET')
var b2 = bucket('BUCKET2')

var keys = []

keys.push(b('hello'))
keys.push(b('goodbye'))

keys.push(b2('bonjour'))

//get the range defined by a bucket like this:
b.range()

//fiter a range like this:

console.log(
 keys.filter(b.range().within)
)

//optionally, pass in start and end keys to restrict the range.

console.log(
 keys.filter(b.range('', 'h').within)
)

License

MIT

Something went wrong with that request. Please try again.