mapEntryValues()function

mapEntryValues(entries: Iterable<Entry<K, I>>, transform: (value: I, ...args: A) => O, ...args: A): Iterable<Entry<K, O>>
ParamType
entriesIterable<Entry<K, I>>
The source iterable of [key, value] entries. required
transform(value: I, ...args: A) => O
Function applied to each value to produce the output value. required
argsA
Additional arguments passed through to transform on every call. required
Return
Iterable<Entry<K, O>>
An iterable of [key, transformedValue] entries.

Lazily transform the values of a set of entries, keeping each key.

  • Only the value is passed to transform, which returns the new value.

Examples

[...mapEntryValues([["a", 1]], v => v * 2)] // [["a", 2]]