Capitalizes a title according to the Chicago Manual of Style.
First, install chicago-capitalize
as a dependency:
npm install --save chicago-capitalize
Then, use it in your scripts, like so:
var capitalize = require('chicago-capitalize')
var input = 'The quick brown fox jumps over the lazy dog.'
var output = capitalize(input)
// Prints 'The Quick Brown Fox Jumps Over the Lazy Dog.'
console.log(output)
You can also pass an options object. For now, the only option is whitelist
:
an array of words not to capitalize. Note that it is case-sensitive.
var input = 'Sent from my iPhone.'
var options = { whitelist: ['iPhone'] }
var output = capitalize(input, options)
// Prints 'Sent from My iPhone.'
console.log(output)
MIT