mapObjKeys
mapObjKeys<
T>(obj,fn):Record<string,T>
Defined in: object/map-obj-keys.ts:16
Maps the keys of an object using a provided mapping function.
Type Parameters
T
T
Parameters
obj
Record<string, T>
The input object whose keys are to be mapped.
fn
(key, value) => string
The mapping function that takes a key and its corresponding value, and returns a new key.
Returns
Record<string, T>
A new object with keys transformed by the mapping function and the same values as the input object.
Example
const original = { a: 1, b: 2, c: 3 };const mapped = mapObjKeys(original, (key, value) => key.toUpperCase());// mapped is { A: 1, B: 2, C: 3 }