1.2.1 • Published 10 months ago

keysto v1.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
10 months ago

keysto

is a humble library to transform javascript object key.

currently supported transformation

  • snake case <--> camel case
  • camel case <--> snake case

Instalation :

npm install keysto

Available Function :

  • .toSnakeCase()
  • .toCamelCase()

Usage :

const keysTo = require('keysto');

let targetObj = { firstName: "Jhon", lastName: "Doe" };
let newObj = keysTo.setKey(targetObj).toSnakeCase();

console.log(newObj); 
// expected : 
// { first_name: "Jhon", last_name: "Doe" }

this keysto also work for array of object and deep nested object. example

let targetArrayOfObj = [
  { firstName: "Jhon", lastName: "Doe" },
  { firstName: "Jane", lastName: "Doe" };
];
let newObj = keysTo.setKey(targetArrayOfObj).toSnakeCase();

console.log(newObj); 
// expected: 
// [
//     { first_name: "Jhon", last_name: "Doe" },
//     { first_name: "Jane", last_name: "Doe" }
// ]
1.2.0

10 months ago

1.2.1

10 months ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago