One common string formatting operation is to capitalize a string. Since strings are immutable, the easiest way to do that would be something like

str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()

which is too much in my opinion for such a simple operation.

One workaround for that would be to use css text-transform, but you can't do that in node.

It would be very handy to have a built in method for that and I guess it can be easily added.

Sorry If this was already discussed somewhere and there is a reason not to do it, I checked the search here and on github but haven't found anything.


It sounds like what you would want is Unicode's title casing operation, which I would expect Intl to be able to handle. Unfortunately, I don't think Intl has that functionality yet.