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
Name | Type | Optional | Description |
---|---|---|---|
input | any | No | Input to validate. |
rangeLower | number | Yes | Optional parameter which specifies the lower range. |
rangeUpper | number | Yes | Optional parameter which specifies the upper range. |
Return value
Returns true
if the input is a finite number.
Example
import { isNumberFinite } from "@tripetto/builder";
isNumberFinite(1); // Returns `true`
isNumberFinite(Infinity); // Returns `false`
isNumberFinite(NaN); // Returns `false`
isNumberFinite("1"); // Returns `false`