UNPKG

predictype

Version:

PredicType is a library of pre-built and tested predicates for TypeScript, covering various data types and operations.

26 lines (25 loc) 1.01 kB
import { BigIntMembershipOper } from '../../enums/bigints.js'; /** * Checks if a bigint value is (or is not) a member of a set of bigints using the specified operation. * * @param source The source bigint value. * @param oper The membership operation to perform (e.g. 'is_one_of', 'is_not_one_of'). * @param target The array of bigints to check membership against. * @returns True if the membership check is valid according to the operator, otherwise false. * * @throws {Error} If the operation is not recognized. * * @example * const value1 = BigInt(5); * const value2 = BigInt(3); * const arr = [BigInt(1), BigInt(2), BigInt(5)]; * * bigintMembership(value1, 'is_one_of', arr); // true * bigintMembership(value2, 'is_not_one_of', arr); // true * * @remarks * Supported Operators: * - **IN**: value is in the target array * - **NOT_IN**: value is not in the target array */ export declare function bigintMembership(source: bigint, oper: BigIntMembershipOper, target: bigint[]): boolean;