predictype / predicates/maps / mapState
mapState<
K
,V
>(source
,oper
):boolean
Defined in: predicates/maps/mapState.ts:24
Checks the state of a Map (empty or not) using the specified operation.
K
V
Map
<K
, V
>
The Map to check.
The state operation to perform (e.g. ‘is_empty’, ‘is_not_empty’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const m1 = new Map();
const m2 = new Map([[1, 'a']]);
mapState(m1, 'is_empty'); // true
mapState(m2, 'is_not_empty'); // true
Supported Operators: