predictype / predicates/maps / mapSize
mapSize<
K,V>(source,oper,target):boolean
Defined in: predicates/maps/mapSize.ts:30
Checks the size of a Map using the specified operation.
K
V
Map<K, V>
The Map 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 m1 = new Map([[1, 'a'], [2, 'b']]);
const m2 = new Map([[1, 'a']]);
const size2 = 2;
const size0 = 0;
mapSize(m1, 'size_equals', size2); // true
mapSize(m2, 'size_greater_than', size0); // true
Supported Operators: