-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,52 @@ | ||
# change-case-object | ||
|
||
[![Build Status](https://travis-ci.org/BinaryThumb/change-case-object.svg?branch=master)](https://travis-ci.org/BinaryThumb/change-case-object) | ||
|
||
[![Coverage Status](https://coveralls.io/repos/BinaryThumb/change-case-object/badge.svg?branch=master&service=github)](https://coveralls.io/github/BinaryThumb/change-case-object?branch=master) | ||
|
||
Changes the case of all object's keys | ||
|
||
## Installation | ||
|
||
`npm install change-case-object` | ||
Currently, only CommonJS environments are supported. (This means Node.js and browser with `browserify` or `webpack`) | ||
|
||
## Example | ||
|
||
```javascript | ||
var changeCaseObject = require('change-case-object'); | ||
|
||
var myObject = { | ||
hello_world: 'hi', | ||
}; | ||
|
||
var newObject = changeCaseObject.camelCase(myObject); | ||
// {helloWorld: 'hi'} | ||
``` | ||
|
||
## Methods | ||
All methods are available under the `changeCaseObject` object after the module has been required. | ||
|
||
### .camelCase | ||
Conerts all object keys into camel case. | ||
`hello_world -> helloWorld` | ||
|
||
### .snakeCase | ||
Conerts all object keys into snake case. | ||
`helloWorld -> hello_world` | ||
|
||
### .paramCase | ||
Conerts all object keys into param case. | ||
`helloWorld -> hello-world` | ||
|
||
Shorthand methods are also available: | ||
``` | ||
.camelCase -> .camel | ||
.snakeCase -> .snake | ||
.paramCase -> .param | ||
``` | ||
|
||
## Code Guideline | ||
AirBnB ES5 | ||
|
||
## License | ||
MIT |