Convert an interval string to a levelup style ltgt object.
This is the counterpart to ltgt-to-interval.
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' }
$ npm install interval-to-ltgt
Parse str
into an levelup style ltgt object.
Intervals sides are inclusive by default, unless when using parens or outward open square brackets.
MIT