predictype / predicates/sets/setSize / setSize
setSize<
T
>(source
,oper
,target
):boolean
Defined in: predicates/sets/setSize.ts:27
Checks the size of a set using the specified operation.
T
Set
<T
>
The set to check.
The size operation to perform (e.g. ‘size_equals’, ‘size_greater_than’).
number
The size to compare against.
boolean
True if the size check is valid according to the operator, otherwise false.
If the operation is not recognized.
const a = new Set([1, 2, 3]);
setSize(a, 'size_equals', 3); // true
setSize(a, 'size_greater_than', 2); // true
Supported Operators: