predictype / predicates/sets/setMembership / setMembership
setMembership<
T
>(source
,oper
,target
):boolean
Defined in: predicates/sets/setMembership.ts:24
Checks membership conditions for elements in a set using the specified operation.
T
Set
<T
>
The set to check.
The membership operation to perform (e.g. ‘contains’, ‘excludes’).
T
The value to check for membership.
boolean
True if the membership check is valid according to the operator, otherwise false.
If the operation is not recognized.
const s = new Set([1, 2, 3]);
setMembership(s, 'contains', 2); // true
setMembership(s, 'excludes', 4); // true
Supported Operators: