is-integer-in-range
Tests if a value is an integer in a specified range
Last updated 8 months ago by djcsdy .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-integer-in-range 
SYNC missed versions from official npm registry.

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

npm install --save is-integer-in-range

or

yarn add is-integer-in-range

Examples

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.

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.

export function isIntegerInRangeFn(start: number, end: number): (value: number) => boolean;

See also

Current Tags

  • 1.0.1                                ...           latest (8 months ago)

2 Versions

  • 1.0.1                                ...           8 months ago
  • 1.0.0                                ...           10 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)

Copyright 2014 - 2017 © taobao.org |