@el3um4s/rename-keys
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

renameKeys & renameKeysAll

Creates a new object from the specified object, where all the keys are in lowercase.

NPM link: @el3um4s/rename-keys

Install and use the package

To use the package in a project:

npm i @el3um4s/rename-keys

and then in a file:

import { renameKeys, renameKeysAll } from "@el3um4s/rename-keys";

const obj = {
  foo: "hello",
  bar: "john",
  it: {
    foo: "ciao",
    bar: "giovanni",
  },
};

const keysMap= { foo: "greeting", bar: "name" },

const lowerCaseObj = renameKeys(obj);
// {
//   greeting: "hello",
//   name: "john",
//   it: {
//      foo: "ciao",
//      bar: "giovanni",
//   },
// }

const lowerCaseAllObj = renameKeysAll(obj);
// {
//   greeting: "hello",
//   name: "john",
//   it: {
//      greeting: "ciao",
//      name: "giovanni",
//   },
// }

Package Sidebar

Install

npm i @el3um4s/rename-keys

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

4.89 kB

Total Files

5

Last publish

Collaborators

  • el3um4s