mapValues
映射对象的值
99 bytes
since v12.1.0
使用方法
给定一个对象和一个 toValue 回调函数,返回一个新对象,其中所有值都通过 toValue 函数映射。回调函数为每个条目提供值和键。
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' }