filter
Import from @varavel/vdl-plugin-sdk/utils/maps.
Filters a Map based on a predicate function.
This function takes a Map and a predicate function, and returns a new Map containing only the entries for which the predicate function returns true.
Type Parameters
| Type Parameter | Description |
|---|---|
K |
The type of keys in the Map. |
V |
The type of values in the Map. |
Parameters
| Parameter | Type | Description |
|---|---|---|
map |
Map\<K, V> |
The Map to filter. |
callback |
(value, key, map) => boolean |
A predicate function that tests each entry. |
Returns
Map\<K, V>
A new Map containing only the entries that satisfy the predicate.