Number
Number utility class that provides various methods for numbers.
The Number class is extended from the built-in Number object. You can continue to use whatever we normally use.
Usage
To use this module, you first need to import the Number class:
import { Number } from '@ponsetya/core'
Static Methods
Number.is()
The is() method determines whether the passed value is an Number.
Number.is(value: unknown): boolean
Parameters
- value:
unknown
- The value to be checked.
- Returns:
boolean
- A boolean indicating whether the variable is a number.
Examples
console.log(Number.is(2)) // true
console.log(Number.is(-2)) // true
console.log(Number.is(2n)) // false
console.log(Number.is('2')) // false