Skip to content

nowsecure/interval-to-ltgt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Convert an interval string to a levelup style ltgt object

Resources

Stars

Watchers

Forks

Packages

No packages published