Skip to content

mapValues

Map over the keys of an object

99 bytes

Usage

Given an object and a toValue callback function, returns a new object with all the values mapped through the toValue function. The callback is given both the value and key for each entry.

import * as _ from 'radashi'
const ra = {
mode: 'god',
power: 'sun',
}
_.mapValues(ra, value => value.toUpperCase()) // => { mode: 'GOD', power: 'SUN' }
_.mapValues(ra, (value, key) => key) // => { mode: 'mode', power: 'power' }