9 lines
276 B
JavaScript
9 lines
276 B
JavaScript
var makeString = require('./helper/makeString');
|
|
|
|
module.exports = function capitalize(str, lowercaseRest) {
|
|
str = makeString(str);
|
|
var remainingChars = !lowercaseRest ? str.slice(1) : str.slice(1).toLowerCase();
|
|
|
|
return str.charAt(0).toUpperCase() + remainingChars;
|
|
};
|