map-keys-deep
v0.0.2
Published
🔑 Maps object keys recursively
Downloads
2,293
Readme
map-keys-deep
🔑 Maps object keys recursively, like mapKeys
by Lodash but recursive.
Usage
Install
yarn add map-keys-deep
Simple sample usage
import mapKeysDeep from 'map-keys-deep';
mapKeysDeep({ Hello: { World: true } }, keys => keys.toLowerCase());
// { hello: { world: true } }
FP style
import { camelCase } from 'lodash/fp';
import mapKeysDeep from 'map-keys-deep/fp';
mapKeysDeep(camelCase)({ hello_world: { bye_world: true } });
// { helloWorld: { byeWorld: true } }
mapKeysDeep(keys => keys.toLowerCase())({ Hello: { World: true } });
// { hello: { world: true } }
Test
yarn jest
License
MIT