# in-range

> Check if a number is in a given range

Latest version **3.0.0** (published 2021-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install in-range
pnpm add in-range
yarn add in-range
bun add in-range
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-01-23 |
| First published | 2015-06-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/in-range) |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | in, range, number, check, is, bigint |

## Links

- npm: https://www.npmjs.com/package/in-range
- Repository: https://github.com/sindresorhus/in-range
- Homepage: https://github.com/sindresorhus/in-range#readme
- Issues: https://github.com/sindresorhus/in-range/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/in-range

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2021-01-23
- 2.0.0 — 2019-04-11
- 1.0.0 — 2015-06-26

## README

# in-range

> Check if a number is in a given range

## Install

```
$ npm install in-range
```

## Usage

```js
import inRange from '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

// Any input can be a BigInt
inRange(30n, {start: 100n, end: 10}); // 10..100
//=> true
```

## API

### inRange(number, range)

#### number

Type: `number | BigInt`

Number to check.

#### range

Type: `object`

##### start?

Type: `number | BigInt`\
Default: `0`

Start of the range.

##### end

Type: `number | BigInt`

End of the range.

---
_Source: https://npm.io/package/in-range · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
