decamelize
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Decamelize is a JavaScript package that provides a convenient way to convert camelized strings into lowercased ones with a custom separator. It's a helpful tool for developers that allows them to transform, for example, a string like 'unicornRainbow' into 'unicorn_rainbow' or 'unicorn-rainbow', depending on the separator chosen. Decamelize is particularly important when dealing with string manipulations in coding practices.
Using decamelize is pretty straightforward. After installing it via npm using the command npm install decamelize
, you can import it into your file using import decamelize from 'decamelize'
.
Once it's imported, decamelizing a string becomes a one-line task:
decamelize('unicornRainbow');
// Output: 'unicorn_rainbow'
You can also customise the separator that's inserted between words:
decamelize('unicornRainbow', {separator: '-'});
// Output: 'unicorn-rainbow'
Furthermore, it's possible to choose whether or not to convert consecutive uppercase letters in keeping with the rest of the string:
decamelize('testGUILabel', {preserveConsecutiveUppercase: true});
// Output: 'test_GUI_label'
The detailed documentation for decamelize, including its installation, usage, and API, can be found on its GitHub page. Taking the time to browse through the documented examples and conditions can greatly improve your coding and problem-solving skills.