import pascalcase from 'pascalcase';// or the following if you preferimport { 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'
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')); //=> 'TheIrsIsMeanconsole.log(pascalcase('The IRS Is Mean', { preserveConsecutiveUppercase: true })); //=> TheIRSIsMeanconsole.log(pascalcase('We saw a UFO')); //=> WeSawAUfoconsole.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
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running Tests
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
Building docs
(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: