Home

Awesome

interval-to-ltgt

Convert an interval string to a levelup style ltgt object.

This is the counterpart to ltgt-to-interval.

build status

Example

var toLtgt = require('interval-to-ltgt');

toLtgt('a,b'); // => { gte: 'a', lte: 'b' }
toLtgt('a,'); // => { gte: 'a' },
toLtgt(',b'); // => { lte: 'b' }
toLtgt('[a,b'); // => { gte: 'a', lte: 'b' }
toLtgt('(a,b'); // => { gt: 'a', lte: 'b' }
toLtgt('[a,b)'); // => { gte: 'a', lt: 'b' }
toLtgt(']a,b['); // => { gt: 'a', lt: 'b' }

Installation

$ npm install interval-to-ltgt

API

toLtgt(str)

Parse str into an levelup style ltgt object.

Intervals sides are inclusive by default, unless when using parens or outward open square brackets.

License

MIT