predictype

predictype v0.8.1


predictype / bigints / bigintComparison

Function: bigintComparison()

bigintComparison(source, oper, target): boolean

Defined in: predicates/bigints/bigintComparison.ts:31

Compares two bigint values using the specified operation.

Parameters

source

bigint

The source bigint value.

oper

BigIntComparisonOper

The comparison operation to perform (e.g. ‘equals’, ‘greater_than’).

target

bigint

The target bigint value to compare against the source.

Returns

boolean

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

Throws

If the operation is not recognized.

Example

const a = BigInt(10);
const b = BigInt(5);
const c = BigInt(20);

bigintComparison(a, 'equals', a); // true
bigintComparison(a, 'greater_than', b); // true
bigintComparison(a, 'less_than', c); // true

Remarks

Supported Operators: