camelcase
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Camelcase is a popular npm package that efficiently converts a dash, dot, underscore, or space separated string into camelCase or PascalCase. This tool is particularly valuable because it correctly handles Unicode strings. Therefore, users inputting untrusted data must remember to limit the length to a reasonable standard to prevent any issues.
Using the camelcase npm package is fairly straightforward. First you need to install the package using npm by typing the command npm install camelcase
in the command line. Once that's done, you can import the package into your script with import camelCase from 'camelcase'
. This package can then be used in various ways to transform your text.
Below are a few examples:
import camelCase from 'camelcase';
camelCase('foo-bar');
// Output: 'fooBar'
camelCase('foo bar');
// Output: 'fooBar'
camelCase('foo_bar');
// Output: 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
// Output: 'FooBar'
You can also use options such as pascalCase
to capitalize the first character, preserveConsecutiveUppercase
to preserve consecutive uppercase characters or locale
to specify the locale to be used for the conversion.
The camelcase documentation is located directly in the package's README on GitHub. Simply visit the GitHub repository at https://github.com/sindresorhus/camelcase to access comprehensive details about the package's functionality, installation, and usage. Along with a detailed API description, the docs feature code examples and descriptions of all the options and related packages.