@unction/mapkeys
v10.13.0
Published
Like map but over the key instead of the value
Downloads
79
Readme
@unction/mapKeys
MapperFunctionType<A, B> => Array | Set | Record<string | number | symbol, B> | Map<B, A> | string => KeyedArray | Set | Record<string | number | symbol, unknown> | Map<B, unknown> | string
Map over a keyed functor's keys and return a new keyed functor having mapped the keys
const attributes = {
name: "Kurtis Rainbolt-Greene",
createdAt: new Date()
}
mapKeys(kebab)(attributes)
Would return:
{
name: "Kurtis Rainbolt-Greene",
"created-at": new Date()
}