🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

in-range

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

in-range

Check if a number is in a given range

Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
5.5K
11.25%
Maintainers
1
Weekly downloads
 
Created
Source

in-range Build Status

Check if a number is in a given range

Install

$ npm install in-range

Usage

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

inRange(30, {end: 100}); // 0..100
//=> true

inRange(30, {start: 10, end: 100}); // 10..100
//=> true

inRange(30, {start: 100, end: 10}); // 10..100
//=> true

inRange(30, {end: 10}); // 0..10
//=> false

API

inRange(number, range)

number

Type: number

Number to check.

range

Type: Object

start

Type: number
Default: 0

Start of the range.

end

Type: number

End of the range.

License

MIT © Sindre Sorhus

Keywords

in

FAQs

Package last updated on 11 Apr 2019

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