1.0.0 • Published 8 years ago

titlify v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

titlify

Tiny module to parse various strings into words and capitalize the first letter of each word.

Installation

$ npm install --save titlify

Usage

titlify(input, forceLowerCase)

Parameters

input: string, String to parse.

forceLowerCase: bool, Specify true in order to force all letters after first letter of word to lowercase or false (default) to keep existing casing after first letter.

var titlify = require('titlify');

titlify('somewhere-over-the-rainbow'); // returns "Somewhere Over The Rainbow" 

titlify('somewhere over the rainbow'); // returns "Somewhere Over The Rainbow" 

titlify('somewhere/over/the.rainbow'); // returns "Somewhere Over The Rainbow"

titlify('SomeWhere-OVER-the-RainBow'); // returns "ShomeWhere OVER The RainBow" 

titlify('SomeWhere-OVER-the-RainBow', true); // returns "Shomewhere Over The Rainbow" 

titlify('SomeWhere-OVER-the-RainBow', false); // returns "ShomeWhere OVER The RainBow" 

License

MIT © Doug Lampe