Skip to main content

isNumberFinite

Validates if the supplied input is a finite number and optionally checks if the number is within the specified range.

Signature

isNumberFinite(input: any, rangeLower?: number, rangeUpper?: number): boolean

Parameters

NameTypeOptionalDescription
inputanyNoInput to validate.
rangeLowernumberYesOptional parameter which specifies the lower range.
rangeUppernumberYesOptional parameter which specifies the upper range.

Return value

Returns true if the input is a finite number.

Example

import { isNumberFinite } from "@tripetto/runner";

isNumberFinite(1); // Returns `true`
isNumberFinite(Infinity); // Returns `false`
isNumberFinite(NaN); // Returns `false`
isNumberFinite("1"); // Returns `false`