mapKeys es-toolkit
Returns a new object with keys transformed through a function.
Usage
mapKeys(object, getNewKey)
Use mapKeys when you want to create a new object by transforming each key. Values remain the same, and only the keys are changed to the results of the getNewKey function.
Parameters
objectT extends Record<PropertyKey, any>required
The object to transform keys from.
getNewKey(value: T[keyof T], key: keyof T, object: T) => Krequired
A function that generates new keys. Receives value, key, and the entire object as parameters.
Returns
Returns a new object with transformed keys.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.