predictype

predictype v0.8.1


predictype / bigints / bigintRange

Function: bigintRange()

bigintRange(source, oper, min, max): boolean

Defined in: predicates/bigints/bigintRange.ts:30

Checks if a bigint value falls within or outside a specified range using the given operation.

Parameters

source

bigint

The source bigint value.

oper

BigIntRangeOper

The range operation to perform (e.g. ‘between’, ‘not_between’).

min

bigint

The minimum value of the range (inclusive).

max

bigint

The maximum value of the range (inclusive).

Returns

boolean

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

Throws

If the operation is not recognized.

Example

const value1 = BigInt(5);
const value2 = BigInt(15);
const min = BigInt(1);
const max = BigInt(10);

bigintRange(value1, 'between', min, max); // true
bigintRange(value2, 'not_between', min, max); // true

Remarks

Supported Operators: