mapEntries()function
mapEntries(entries: Iterable<Entry<K, I>>, transform: (entry: Entry<K, I>, ...args: A) => O, ...args: A): Iterable<Entry<K, O>>
| Param | Type | |
|---|---|---|
entries | Iterable<Entry<K, I>> | The source iterable of [key, value] entries. required |
transform | (entry: Entry<K, I>, ...args: A) => O | Function applied to each entry to produce the output value. required |
args | A | 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.
- The whole
[key, value]entry is passed totransform, which returns the new value.
Examples
[...mapEntries([["a", 1]], ([, v]) => v * 2)] // [["a", 2]]