Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inDemoInstall

decamelize

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Issues
File Explorer

Advanced tools

decamelize

Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow

    6.0.0latest
    Github

Version published
Maintainers
1
Weekly downloads
29,041,771
increased by2.18%

Weekly downloads

Readme

Source

decamelize

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

If you use this on untrusted user input, don't forget to limit the length to something reasonable.

Install

npm install decamelize

Usage

import decamelize from '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.

import decamelize from 'decamelize'; decamelize('unicornRainbow'); //=> 'unicorn_rainbow' decamelize('unicornRainbow', {separator: '-'}); //=> 'unicorn-rainbow'
preserveConsecutiveUppercase

Type: boolean
Default: false

Preserve sequences of uppercase characters.

import decamelize from 'decamelize'; decamelize('testGUILabel'); //=> 'test_gui_label' decamelize('testGUILabel', {preserveConsecutiveUppercase: true}); //=> 'test_GUI_label'

See camelcase for the inverse.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

What is decamelize?

Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow

Is decamelize popular?

The npm package decamelize receives a total of 27,624,773 weekly downloads. As such, decamelize popularity was classified as popular.

Is decamelize well maintained?

We found that decamelize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 01 Oct 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket[email protected]

Product

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc