1.0.1 • Published 3 years ago

is-num-between v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

is-between

Created: Mar 31, 2021 11:35 AM

is-num-between

  • Package for determining whether a number is between min and max with an inclusive flag for extra clarity.

Installation

Install with npm:

$ npm install is-num-between

Usage

import {isBetween} from 'is-num-between'

isBetween(1, 1, 3, true) //true

isBetween(1, 1, 3) //false

isBetween(2, 1, 3) //true

API Reference

isBetween(value, min, max, inclusive): boolean

Returns if the value is between the min and max.

ArgumentTypeDescription
valuenumberValue to be tested if it falls within the range.
minnumberThe minimum of the range.
maxnumberThe maximum of the range
inclusivebooleanDetermines if the value can be equal to the min or max.