predictype / predicates/sets/setRelation / setRelation
setRelation<
T
>(source
,oper
,target
):boolean
Defined in: predicates/sets/setRelation.ts:32
Checks the relation between two sets (disjoint, intersects, subset, superset) using the specified operation.
T
Set
<T
>
The first set.
The relation operation to perform (e.g. ‘disjoint’, ‘subset_of’).
Set
<T
>
The second set.
boolean
True if the relation check is valid according to the operator, otherwise false.
If the operation is not recognized.
const a = new Set([1, 2]);
const b = new Set([2, 3]);
const c = new Set([4, 5]);
setRelation(a, 'intersects', b); // true
setRelation(a, 'disjoint', c); // true
setRelation(a, 'subset_of', b); // true
setRelation(a, 'superset_of', b); // false
Supported Operators: