change-object-case

192 阅读1分钟

更改所选文本的大小写。

demo:

var changeCaseObject = require('change-case-object');

var myObject = {
  hello_world: 'hi',
};

var newObject = changeCaseObject.camelCase(myObject);

方法:

.camelCase

//将所有对象键转换为驼峰式大小写。
hello_world -> helloWorld

.snakeCase

//将所有对象键转换为蛇形盒。
helloWorld -> hello_world

.paramCase

//将所有对象键转换为参数大小写。
helloWorld -> hello-world

方法名简称:

.camelCase -> .camel
.snakeCase -> .snake
.paramCase -> .param

来源链接:npm.taobao.org/package/cha…