headercase
Convert a string to HTTP header case.
Usage
var headercase = require( '@stdlib/string/base/headercase' );
headercase( str )
Converts a string to HTTP header case.
var out = headercase( 'foo bar' );
// returns 'Foo-Bar'
out = headercase( 'IS_MOBILE' );
// returns 'Is-Mobile'
out = headercase( 'Hello World!' );
// returns 'Hello-World'
out = headercase( '--foo-bar--' );
// returns 'Foo-Bar'
Examples
var headercase = require( '@stdlib/string/base/headercase' );
var str = 'Hello World!';
var out = headercase( str );
// returns 'Hello-World'
str = 'HELLO WORLD!';
out = headercase( str );
// returns 'Hello-World'
str = 'To be, or not to be: that is the question.';
out = headercase( str );
// returns 'To-Be-Or-Not-To-Be-That-Is-The-Question'