Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softwareventures/is-integer-in-range
Tests if a value is an integer in a specified range
https://github.com/softwareventures/is-integer-in-range
Last synced: 3 days ago
JSON representation
Tests if a value is an integer in a specified range
- Host: GitHub
- URL: https://github.com/softwareventures/is-integer-in-range
- Owner: softwareventures
- License: isc
- Created: 2020-03-09T08:08:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-11T19:11:46.000Z (3 days ago)
- Last Synced: 2024-11-11T20:20:14.019Z (3 days ago)
- Language: TypeScript
- Size: 2.06 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# is-integer-in-range
Tests if a value is an integer in a specified range.
The range is inclusive of the start and end values.
## Install
```bash
npm install --save is-integer-in-range
```or
```bash
yarn add is-integer-in-range
```## Examples
```typescript
import isIntegerInRange from "is-integer-in-range";
isIntegerInRange(5, 1, 10); // -> true
isIntegerInRange(5.1, 1, 10); // -> false
isIntegerInRange(0, 1, 10); // -> false
isIntegerInRange(1, 1, 10); // -> true
isIntegerInRange(10, 1, 10); // -> true
isIntegerInRange(11, 1, 10); // -> false
```## API
### isIntegerInRange
Tests if the specified value is an integer in the specified range.
The range is inclusive of the start and end values.
```typescript
export default function isIntegerInRange(
value: number,
start: number,
end: number
): boolean;
```### isIntegerInRangeFn
Curried variant of `isIntegerInRange`.
Takes a range specified as a start and end value, and returns a function that
tests if a specified value is within the range.The range is inclusive of the start and end values.
```typescript
export function isIntegerInRangeFn(
start: number,
end: number
): (value: number) => boolean;
```## See also
- [is-integer](https://www.npmjs.com/package/is-integer)