mapValues
Import from @varavel/vdl-plugin-sdk/utils/maps.
Creates a new Map with the same keys but with values transformed by the provided function.
This function takes a Map and a function that generates a new value from each value-key pair. It returns a new Map where the values are the result of applying the function to each entry, while the keys remain the same.
Type Parameters
| Type Parameter | Description |
|---|---|
K |
The type of keys in the Map. |
V |
The type of values in the Map. |
R |
- |
Parameters
| Parameter | Type | Description |
|---|---|---|
map |
Map\<K, V> |
The Map to transform. |
getNewValue |
(value, key, object) => R |
A function that generates a new value from a value-key pair. |
Returns
Map\<K, R>
A new Map with the same keys and transformed values.