blob: 7602a872a07ebc0429e4f232a4ad7ca30ee2a77c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# decamelize-keys [![Build Status](https://travis-ci.org/dsblv/decamelize-keys.svg?branch=master)](https://travis-ci.org/dsblv/decamelize-keys)
> Convert object keys from camelCase to lowercase with a custom separator using [`decamelize`](https://github.com/sindresorhus/decamelize)
*This project was forked from [`camelcase-keys`](https://github.com/sindresorhus/camelcase-keys) and converted to do the opposite*
## Install
```sh
$ npm install --save decamelize-keys
```
## Usage
```js
const decamelizeKeys = require('decamelize-keys');
decamelizeKeys({fooBar: true}, '-');
//=> {'foo-bar': true}
```
## API
### decamelizeKeys(input, [separator], [options])
### input
Type: `object`
*Required*
Object to decamelize.
### separator
Type: `string`
Default: `_`
A string to insert between words.
### options
Type: `object`
#### separator
Type: `string`
Default: `_`
Alternative way to specify [separator](#separator).
#### exclude
Type: `array`
Default: `[]`
Exclude keys from being decamelized.
## Related
See [`camelcase-keys`](https://github.com/sindresorhus/camelcase-keys) for the inverse.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com), [Dmirty Sobolev](https://github.com/dsblv)
|