predictype

predictype v0.8.1


predictype / predicates/bigints/bigintState / bigintState

Function: 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.

Parameters

source

bigint

The source bigint value.

oper

BigIntStateOper

The state operation to perform (e.g. ‘is_zero’, ‘is_even’).

Returns

boolean

True if the state check is valid according to the operator, otherwise false.

Throws

If the operation is not recognized.

Example

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

Remarks

Supported Operators: