Check if a number is in a specified range
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore
.jshintrc
.travis.yml
index.js
license
package.json
readme.md
test.js

readme.md

in-range Build Status

Check if a number is in a specified range

Install

$ npm install --save in-range

Usage

var inRange = require('in-range');

inRange(30, 100); // 0..100
//=> true

inRange(30, 10, 100); // 10..100
//=> true

inRange(30, 100, 10); // 10..100
//=> true

inRange(30, 10); // 0..10
//=> false

API

inRange(value, end)

inRange(value, start, end)

value

Type: number

Number to check.

start

Type: number
Default: 0

Start of the range.

end

Type: number

End of the range.

License

MIT © Sindre Sorhus