0.0.1 • Published 11 years ago
key-range v0.0.1
key-range
return whether a string key is within a levelup-style range
example
var range = require('key-range');
console.log(range('abc', { start: 'aaa', end: 'azz' }));
console.log(range('xyz', { lt: 'xyz' }));
console.log(range('gz', { gte: 'gz' }));
console.log(range('qrs', { gt: 'q', lt: 'r' }));
output:
true
false
true
true
methods
var range = require('key-range')
range(key, opts)
Return a boolean: whether the string key
matches the range constraints given
by opts
.
opts
may include any one of:
opts.start
opts.end
opts.lt
opts.lte
opts.gt
opts.gte
opts.min
opts.max
These correspond to the range options supported by
levelup, although {lt,gt}{,e}
is
the preferred form.
install
With npm do:
npm install key-range
license
MIT