in-between
Test whether a number, english alphabet character or a date is between two others.
Augmented version of in-range made by Sindre Sorhus with a more functional taste
Install
$ npm install in-between
Usage
With numbers:
const between = const between1and10 = //=> false //=> true //=> throws error //=> false 101 //=> true
Works with alphabet characters:
const between = const betweenAandD = //=> true //=> false
Works with Dates as well:
const between = let myGraduation = "October 13, 2014 11:13:00" let myFirstJob = "September 1, 2015 11:13:00" let myBirthDay = "January 10, 2015 10:11:03" myBirthDay //=> true
You can include the boundaries:
const between = 3 //=> true 'a' // => true
API
between(number | string | date, number | string | date, boolean) => function(number | string | date) => boolean
License
MIT © Alvaro Bernal