Convert a string to pascal-case.
Last updated a year ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pascalcase 
SYNC missed versions from official npm registry.

pascalcase Donate NPM version NPM monthly downloads NPM total downloads Linux Build Status

Convert a string to pascal-case.

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 >=8):

$ npm install --save pascalcase


const pascalcase = require('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('')); //=> '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'


<summary> Contributing</summary>

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

<summary> Running Tests</summary>

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
<summary> Building docs</summary>

(This project's is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the readme template.)

To generate the readme, run the following command:

$ 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


Jon Schlinkert


Copyright © 2019, Jon Schlinkert. Released under the MIT License.

This file was generated by verb-generate-readme, v0.8.0, on August 08, 2019.

Current Tags

  • 1.0.0                                ...           latest (a year ago)

3 Versions

  • 1.0.0                                ...           a year ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Today 3,768
This Week 122,883
This Month 229,523
Last Day 28,968
Last Week 166,273
Last Month 682,393
Dependencies (0)
Dev Dependencies (2)
Dependents (120)

Copyright 2014 - 2016 © |