predictype / predicates/bigints/bigintState / bigintState
bigintState(
source
,oper
):boolean
Defined in: predicates/bigints/bigintState.ts:29
Checks the state of a bigint value (zero, positive, negative, even, odd) using the specified operation.
bigint
The source bigint value.
The state operation to perform (e.g. ‘is_zero’, ‘is_even’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const zero = BigInt(0);
const even = BigInt(10);
const negative = BigInt(-5);
bigintState(zero, 'is_zero'); // true
bigintState(even, 'is_even'); // true
bigintState(negative, 'is_negative'); // true
Supported Operators: