@adso-ts/map-keys-deep
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Map keys deep

Performs deep map of object's keys

Import

import { mapKeysDeep } from '@adso-ts/map-keys-deep';

How to use

const originalObject = {
  prop_a: 'value',
  prop_b: {
    prop_c: 'value'
  }
}

const iteratorFn = (key : string) => key.toUpperCase();
// flat objects
const transformedObject = mapKeysDeep(originalObject, iteratorFn);
// nested objects
const transformedObject = mapKeysDeep(originalObject, (_value: any, key: any) => iteratorFn(key));

Package Sidebar

Install

npm i @adso-ts/map-keys-deep

Weekly Downloads

11

Version

1.0.7

License

MIT

Unpacked Size

4.43 kB

Total Files

9

Last publish

Collaborators

  • asokolowski