homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge
69 lines (48 loc) • 1.07 kB
Markdown
recursively transform key strings to dash-case
[](http://travis-ci.org/shahata/dasherize)
[](http://ci.testling.com/shahata/dasherize)
``` js
var dasherize = require('dasherize');
var obj = {
feeFieFoe: 'fum',
beepBoop: [
{ 'abcXyz': 'mno' },
{ 'fooBar': 'baz' }
]
};
var res = dasherize(obj);
console.log(JSON.stringify(res, null, 2));
```
output:
```
{
"fee-fie-foe": "fum",
"beep-boop": [
{
"abc-xyz": "mno"
},
{
"foo-bar": "baz"
}
]
}
```
``` js
var dasherize = require('dasherize')
```
Convert the key strings in `obj` to dash-case recursively.
Convert the string to dash-case.
With [npm](https://npmjs.org) do:
```
npm install dasherize
```
To use in the browser, use [browserify](http://browserify.org).
derives directly from [camelize](https://github.com/substack/camelize)
MIT