Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow
Switch branches/tags
Clone or download
Latest commit 7e6b97d Jan 8, 2018
Permalink
Failed to load latest commit information.
.editorconfig Meta tweaks Dec 3, 2017
.gitattributes Meta tweaks Dec 3, 2017
.gitignore Meta tweaks Dec 3, 2017
.npmrc Meta tweaks Dec 3, 2017
.travis.yml Meta tweaks Dec 3, 2017
index.js Add comment about future regex Jan 8, 2018
license Meta tweaks Dec 3, 2017
package.json 2.0.0 Jan 8, 2018
readme.md Meta tweaks Dec 3, 2017
test.js Add support for unicode characters (#11) Jan 8, 2018

readme.md

decamelize Build Status

Convert a camelized string into a lowercased one with a custom separator
Example: unicornRainbowunicorn_rainbow

Install

$ npm install decamelize

Usage

const decamelize = require('decamelize');

decamelize('unicornRainbow');
//=> 'unicorn_rainbow'

decamelize('unicornRainbow', '-');
//=> 'unicorn-rainbow'

API

decamelize(input, [separator])

input

Type: string

separator

Type: string
Default: _

Related

See camelcase for the inverse.

License

MIT © Sindre Sorhus