Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including propercase with all npm packages installed. Try it out:

var propercase = require("propercase")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

propercase v1.0.2

A simple module to proper case strings (e.g. names)

This simple module can be used to proper case (sometimes called title case) a string.

It works by lower-casing the string and then capitalizing the first character after certain special characters.

Right now these special characters are defined by: var characters = [' ', '-', ''', '.'];

Installation

npm install propercase --save

Usage

var pcase = require('propercase');

console.log(pcase("whaaat? my first public m'odule"));

Examples:

"jim test" becomes "Jim Test"

"JIM TEST" becomes "Jim Test"

"conan o'brien" becomes "Conan O'Brien"

"CONAN O'BRIEN" becomes "Conan O'Brien"

"This-Is A Mix'Of'Tests For Mr.Smith And Mr.Jones" becomes "This-Is A Mix'Of'Tests For Mr.Smith And Mr.Jones"

Regards,

Jim

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free