3.1.3 • Published 10 years ago

idb-range v3.1.3

Weekly downloads
429
License
MIT
Repository
github
Last release
10 years ago

idb-range

MongoDB inspired interface for IDBKeyRange.

npm.io

npm.io npm.io npm.io

Installation

npm install --save idb-range

Example

import range from 'idb-range'

range({ lte: 'a', gt: 'b' }) // IDBKeyRange {lower: "a", upper: "b", lowerOpen: true, upperOpen: true}
range({ gte: 'c' }) // IDBKeyRange {lower: "c", upper: undefined, lowerOpen: false, upperOpen: true}

// it accepts a specific value as a shortcut to IDBKeyRange.only
range('hello') // IDBKeyRange {lower: "hello", upper: "hello", lowerOpen: false, upperOpen: false}
// but it's more explicit to always use object notation
range({ eq: 'hello' })

// IDBKeyRange and no arguments are ignored
range(IDBKeyRange.only('hello')) // ignores IDBKeyRange instances
range() // null

range(opts)

Parse opts to valid IDBKeyRange.

Available options, when opts is an object:

  • gt - greater
  • lt - lighter
  • gte - greater equal
  • lte - lighter equal
  • eq - equal

License

MIT

3.1.3

10 years ago

3.1.2

10 years ago

3.1.1

10 years ago

3.1.0

10 years ago

3.0.0

10 years ago

2.4.0

10 years ago

2.3.1

10 years ago

2.3.0

10 years ago

2.2.0

10 years ago

2.1.0

10 years ago

2.0.0

10 years ago

1.0.0

11 years ago