Dot-free title function with Ramda
It would be like this:
const capitalize = R.compose(
R.join(''),
R.juxt([R.compose(R.toUpper, R.head), R.tail])
);
Demo (at ramdajs.com REPL).
And a minor modification to handle the nullvalues
const capitalize = R.compose(
R.join(''),
R.juxt([R.compose(R.toUpper, R.head), R.tail])
);
const capitalizeOrNull = R.ifElse(R.equals(null), R.identity, capitalize);
I put together some quick and dirty tests for everyone who is interested. It looks like @ lax4mike is the fastest answer provided (although the simpler, non-dotted str[0].toUpperCase() + str.slice(1)way is faster [and also not the one the OP was asking about, so debate]).
https://jsfiddle.net/960q1e31/ (you need to open the console and run the script to see the results)