Miss any of our Open RFC calls?Watch the recordings here! »

@bemoje/numeric-range

1.1.1 • Public • Published

@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

NPM version

Travis CI

dependencies

Dependencies

dependencies

Stats

NPM downloads Forks

Donate

Buy Me A Beer donate button PayPal donate button

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, default Number.MIN_SAFE_INTEGER)

  • max number The maximum value of the range (optional, default Number.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

Install

npm i @bemoje/numeric-range

DownloadsWeekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

10.3 kB

Total Files

5

Last publish

Collaborators

  • avatar