https://github.com/aircity/browser-camelcase-keys
https://github.com/aircity/browser-camelcase-keys
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aircity/browser-camelcase-keys
- Owner: Aircity
- Created: 2019-01-23T02:52:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-23T02:59:04.000Z (over 7 years ago)
- Last Synced: 2025-05-19T16:14:34.731Z (about 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# camelcase-keys [](https://travis-ci.org/sindresorhus/camelcase-keys)
> Convert object keys to camelCase using [`camelcase`](https://github.com/sindresorhus/camelcase)
## Install
```
$ npm install camelcase-keys
```
## Usage
```js
const camelcaseKeys = require('camelcase-keys');
// Convert an object
camelcaseKeys({'foo-bar': true});
//=> {fooBar: true}
// Convert an array of objects
camelcaseKeys([{'foo-bar': true}, {'bar-foo': false}]);
//=> [{fooBar: true}, {barFoo: false}]
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
//=> {fooBar: true, nested: {unicornRainbow: true}}
```
```js
const camelcaseKeys = require('camelcase-keys');
const argv = require('minimist')(process.argv.slice(2));
//=> {_: [], 'foo-bar': true}
camelcaseKeys(argv);
//=> {_: [], fooBar: true}
```
## API
### camelcaseKeys(input, [options])
#### input
Type: `Object` `Object[]`
Object or array of objects to camelCase.
#### options
Type: `Object`
##### exclude
Type: `Array`
Default: `[]`
Exclude keys from being camelCased.
##### deep
Type: `boolean`
Default: `false`
Recurse nested objects and objects in arrays.
## Related
- [snakecase-keys](https://github.com/bendrucker/snakecase-keys)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)