capitalize.js 276 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 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; };