mapKeys
Map over the keys of an object
100 bytes
Usage
Given an object and a toKey callback function, returns a new object with all the keys
mapped through the toKey function. The callback is given both the key and value for each entry.
import * as import _
_ from 'radashi'
const const ra: { mode: string; power: string;}
ra = { mode: string
mode: 'god', power: string
power: 'sun',}
import _
_.mapKeys<string, "mode" | "power", string>(obj: Record<"mode" | "power", string>, mapFunc: (key: "mode" | "power", value: string) => string): Record<string, string>export mapKeys
Map over all the keys of an object to return a new object.
mapKeys(const ra: { mode: string; power: string;}
ra, key: "mode" | "power"
key => key: "mode" | "power"
key.String.toUpperCase(): string
Converts all the alphabetic characters in a string to uppercase.
toUpperCase()) // => { MODE, POWER }import _
_.mapKeys<string, "mode" | "power", string>(obj: Record<"mode" | "power", string>, mapFunc: (key: "mode" | "power", value: string) => string): Record<string, string>export mapKeys
Map over all the keys of an object to return a new object.
mapKeys(const ra: { mode: string; power: string;}
ra, (key: "mode" | "power"
key, value: string
value) => value: string
value) // => { god: 'god', power: 'power' }