predictype / predicates/numbers / numberState
numberState(
source
,oper
):boolean
Defined in: predicates/numbers/numberState.ts:28
Checks the state of a number (integer, float, finite, positive, negative, zero) using the specified operation.
number
The number to check.
The state operation to perform (e.g. ‘is_integer’, ‘is_float’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const n = 5;
numberState(n, 'is_integer'); // true
numberState(3.14, 'is_float'); // true
numberState(0, 'is_zero'); // true
Supported Operators: