isNumber
Validates if the supplied input is a number (finite or infinite). To make sure the supplied number is a valid finite number, use isNumberFinite
.
Signature
isNumber(input: any): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
input | any | No | Input to validate. |
Return value
Returns true
if the input is a number.
Example
import { isNumber } from "@tripetto/builder";
isNumber(1); // Returns `true`
isNumber(Infinity); // Returns `true`
isNumber(NaN); // Returns `false`
isNumber("1"); // Returns `false`