New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

in-between

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

in-between

Test whether a number, english alphabet character or Date is between two others.

latest
Source
npmnpm
Version
5.2.0
Version published
Maintainers
1
Created
Source

in-between

Test whether a number, english alphabet character or a date is between two others.

Build Status npm version JavaScript Style Guide

Augmented version of in-range made by Sindre Sorhus with a more functional taste

Install

$ npm install in-between

Usage

With numbers:

const between = require('in-between')

const between1and10 = between(1, 10)

between1and10(10) //=> false

between1and10(3) //=> true

betweenAandZ('*') //=> throws error

between1and10(1) //=> false

between(100, 200)(101) //=> true

Works with alphabet characters:


const between = require('in-between')

const betweenAandD = between('a', 'd')

betweenAandD('b') //=> true

betweenAandD('z') //=> false

Works with Dates as well:


const between = require('in-between')

let myGraduation = new Date("October 13, 2014 11:13:00")

let myFirstJob =  new Date("September 1, 2015 11:13:00")

let myBirthDay =  new Date("January 10, 2015 10:11:03")

between(myGraduation, myFirstJob)(myBirthDay) //=> true

You can include the boundaries:


const between = require('in-between')

between(3, 4, true)(3) //=> true

between('a', 'b', true)('a') // => true

API

between(number | string | date, number | string | date, boolean) => function(number | string | date) => boolean

License

MIT © Alvaro Bernal

Keywords

between

FAQs

Package last updated on 25 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts