key-range

0.0.1 • Public • Published

key-range

return whether a string key is within a levelup-style range

build status

testling badge

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

Readme

Keywords

none

Package Sidebar

Install

npm i key-range

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • nopersonsmodules