change-names
v0.1.0
Published
Change JavaScript string, Object properties name.
Downloads
3
Maintainers
Readme
Change JavaScript string, Object properties name.
Change the object properties or string to camel case, snake case, parscal case.
Install
npm i change-names
Usage
import change, { camelCase, snakeCase, pascalCase } from "change-names";
//change string
camelCase("CamelCase"); // → camelCase
snakeCase("camelCase"); // → camel_case
pascalCase("camel_case"); // → CamelCase
// Change the object's property name to snakecase.
change(
{
camelCase: {
camelCase2: 2,
camelCase3: 4,
},
},
snakeCase
);
// camel_case: {
// camel_case2: 2,
// camel_case3: 4,
// }
// Change the object's property name to camelcase.
change(
{
camel_case: {
camel_case2: 2,
camel_case3: 4,
},
},
camelCase
);
// camelCase: {
// camelCase2: 2,
// camelCase3: 4,
// },
// Change the object's property name to pascalcase.
change(
{
camel_case: {
camel_case2: 2,
camel_case3: 4,
},
},
pascalCase
);
// {
// CamelCase: {
// CamelCase2: 2,
// CamelCase3: 4,
// },
// }
release note
0.0.2
- publish
0.1.0
- typescript support