Big update!Introducing GitHub Bot Commands. Learn more
Socket
BlogLoveLog in
Book a demo

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

Version published
Maintainers
1
Weekly downloads
27,450,096
decreased by-3.09%

Weekly downloads

Changelog

Source

Breaking

  • Require Node.js 12.20 (#33) 2597adb
  • This package is now pure ESM. Please read this.

https://github.com/sindresorhus/decamelize/compare/v5.0.1...v6.0.0

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 26,194,407 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
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc