Package Exports
- decamelize
- decamelize/index
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (decamelize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
decamelize
Convert a camelized string into a lowercased one with a custom separator
Example:unicornRainbow
→unicorn_rainbow
Install
$ npm install decamelize
Usage
const decamelize = require('decamelize');
decamelize('unicornRainbow');
//=> 'unicorn_rainbow'
decamelize('unicornRainbow', {separator: '-'});
//=> 'unicorn-rainbow'
decamelize('testGUILabel', {preserveConsecutiveUppercase: true});
//=> 'test_GUI_label'
decamelize('testGUILabel', {preserveConsecutiveUppercase: false});
//=> 'test_gui_label'
API
decamelize(input, options?)
input
Type: string
options
Type: object
separator
Type: string
Default: '_'
Character or string inserted to separate words in string
.
cosnt decamelize = require('decamelize');
decamelize('unicornRainbow');
//=> 'unicorn_rainbow'
decamelize('unicornRainbow', {separator: '-'});
//=> 'unicorn-rainbow'
preserveConsecutiveUppercase
Type: boolean
Default: false
Preserve sequences of uppercase characters.
const decamelize = require('decamelize');
decamelize('testGUILabel');
//=> 'test_gui_label'
decamelize('testGUILabel', {preserveConsecutiveUppercase: true});
//=> 'test_GUI_label'
Related
See camelcase
for the inverse.
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.