@bemoje/numeric-range
A class with min and max properties and exposes methods for determining if a value is inside or outside the range between the min and max values.
Version
Travis CI
Dependencies
Stats
Donate
Installation
npm install @bemoje/numeric-range
npm install --save @bemoje/numeric-range
npm install --save-dev @bemoje/numeric-range
Usage
import NumericRange from '@bemoje/numeric-range'
const range = new NumericRange(1, 10)
range.isInside(4)
//=> true
range.isInside(0)
//=> false
range.isOutside(4)
//=> false
range.isOutside(0)
//=> true
Tests
Uses Jest to test module functionality. Run tests to get coverage details.
npm run test
API
NumericRange
A class with min and max properties and exposes methods for determining if a value is inside or outside the range between the min and max values.
Parameters
-
min
number The minimum value of the range (optional, defaultNumber.MIN_SAFE_INTEGER
) -
max
number The maximum value of the range (optional, defaultNumber.MAX_SAFE_INTEGER
)
isInside
Parameters
-
value
number The numeric value to determine whether or not is inside the range.
Returns
boolean boolean
isOutside
Parameters
-
value
number The numeric value to determine whether or not is outside the range.
Returns
boolean boolean