pascalcase

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
Install with npm (requires Node.js >=14):
$ npm install --save pascalcase
Prerequisites
Requires Node.js version >= 14.
Usage
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'
Uppercase character sequences
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
Options
All options are passed to sindresorhus/camelcase, please visit that project to learn about all available options.
About
sh
$ npm install && npm test
sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Related projects
You might also be interested in these projects:
- ansi-colors: Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in… more | homepage
- justified: Wraps words to a specified length and justifies the text in each line. | homepage
- randomatic: Generate randomized strings of a specified length using simple character sequences. The original generate-password. | homepage
- word-wrap: Wrap words to a specified length. | homepage
Author
Jon Schlinkert
License
Copyright © 2021, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on December 29, 2021.