function startcase( str ) {
	var cap;
	var out;
	var ch;
	var i;

	cap = true;
	out = '';
	for ( i = 0; i < str.length; i++ ) {
		ch = str.charAt( i );
		if ( reWhitespace.test( ch ) ) {
			cap = true;
		} else if ( cap ) {
			ch = ch.toUpperCase();
			cap = false;
		}
		out += ch;
	}
	return out;
}
Capitalizes the first letter of each word in an input string.

@param {string} str - string to convert
@returns {string} start case string

@example
var str = startcase( 'beep boop foo bar' );
// returns 'Beep Boop Foo Bar'