predictype / predicates/maps / mapEntry
mapEntry<
K
,V
>(source
,oper
,entry
):boolean
Defined in: predicates/maps/mapEntry.ts:26
Checks if a Map contains (or lacks) a specific entry (key-value pair) using the specified operation.
K
V
Map
<K
, V
>
The Map to check.
The entry operation to perform (e.g. ‘has_entry’, ‘lacks_entry’).
[K
, V
]
The [key, value] pair to check for.
boolean
True if the entry check is valid according to the operator, otherwise false.
If the operation is not recognized.
const m = new Map([[1, 'a']]);
const entry1 = [1, 'a'];
const entry2 = [2, 'b'];
mapEntry(m, 'has_entry', entry1); // true
mapEntry(m, 'lacks_entry', entry2); // true
Supported Operators: