predictype

predictype v0.8.1


predictype / predicates/sets/setIntersection / setIntersection

Function: setIntersection()

setIntersection<T>(source, oper, target): boolean

Defined in: predicates/sets/setIntersection.ts:26

Checks intersection properties between two sets using the specified operation.

Type Parameters

T

T

Parameters

source

Set<T>

The first set.

oper

SetIntersectionOper

The intersection operation to perform (e.g. ‘disjoint’, ‘intersects’).

target

Set<T>

The second set.

Returns

boolean

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

Throws

If the operation is not recognized.

Example

const a = new Set([1, 2]);
const b = new Set([2, 3]);
const c = new Set([4, 5]);

setIntersection(a, 'intersects', b); // true
setIntersection(a, 'disjoint', c); // true

Remarks

Supported Operators: