
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
The pascalcase npm package is a simple utility that converts strings into PascalCase format. This can be useful for formatting variable names, class names, or other identifiers in programming to adhere to PascalCase naming conventions.
String Conversion to PascalCase
Converts a given string to PascalCase by splitting the string into words, capitalizing the first letter of each word, and then concatenating them without spaces.
"hello world".split(' ').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join('')
The camelcase package converts strings to camelCase format. It is similar to pascalcase but the first letter of the resulting string is lowercase, which is the main difference between camelCase and PascalCase.
This is a more comprehensive string transformation library that includes various case conversion methods including pascalCase, camelCase, snake_case, and more. It offers more functionality compared to the single-purpose pascalcase package.
Similar to pascalcase, uppercamelcase converts strings to UpperCamelCase (another name for PascalCase). The functionality is very similar, but the package names suggest a different naming convention for the same string transformation.
Convert a string to pascal case (upper camelcase).
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install with npm (requires Node.js >=14):
$ npm install --save pascalcase
Requires Node.js version >= 14.
import pascalcase from 'pascalcase';
// or the following if you prefer
import { pascalcase } from 'pascalcase';
console.log(pascalcase('a')); //=> 'A'
console.log(pascalcase('foo bar baz')); //=> 'FooBarBaz'
console.log(pascalcase(' foo bar baz ')); //=> 'FooBarBaz'
console.log(pascalcase('foo_bar-baz')); //=> 'FooBarBaz'
console.log(pascalcase('foo.bar.baz')); //=> 'FooBarBaz'
console.log(pascalcase('foo/bar/baz')); //=> 'FooBarBaz'
console.log(pascalcase('foo[bar)baz')); //=> 'FooBarBaz'
console.log(pascalcase('#foo+bar*baz')); //=> 'FooBarBaz'
console.log(pascalcase('$foo~bar`baz')); //=> 'FooBarBaz'
console.log(pascalcase('_foo_bar-baz-')); //=> 'FooBarBaz'
console.log(pascalcase('foo 2 bar 5 baz')); //=> 'Foo2Bar5Baz'
console.log(pascalcase('foo2bar5baz')); //=> 'Foo2bar5baz'
If you wish to preserve upper case character sequences, you may pass an options object with the preserveConsecutiveUppercase
option set to true
:
console.log(pascalcase('The IRS Is Mean')); //=> 'TheIrsIsMean
console.log(pascalcase('The IRS Is Mean', { preserveConsecutiveUppercase: true })); //=> TheIRSIsMean
console.log(pascalcase('We saw a UFO')); //=> WeSawAUfo
console.log(pascalcase('We saw a UFO', { preserveConsecutiveUppercase: true })); //=> WeSawAUFO
All options are passed to sindresorhus/camelcase, please visit that project to learn about all available options.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
You might also be interested in these projects:
Jon Schlinkert
Copyright © 2021, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on December 29, 2021.
FAQs
Convert a string to pascal case (upper camelcase).
The npm package pascalcase receives a total of 11,492,546 weekly downloads. As such, pascalcase popularity was classified as popular.
We found that pascalcase 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.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.