dasherize
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/dasherize package

2.0.0 • Public • Published

dasherize

recursively transform key strings to dash-case

build status

browser support

example

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"
    }
  ]
}

methods

var dasherize = require('dasherize')

dasherize(obj)

Convert the key strings in obj to dash-case recursively.

dasherize(str)

Convert the string to dash-case.

install

With npm do:

npm install dasherize

To use in the browser, use browserify.

license

derives directly from camelize

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    475,841
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    475,841
  • 1.0.0
    2

Package Sidebar

Install

npm i dasherize

Weekly Downloads

475,843

Version

2.0.0

License

MIT

Last publish

Collaborators

  • shahata