/** * Converts a string to title case. * Title case capitalizes the first character of each word in the string, * and sets the remaining characters to lowercase. * * @param {string} str - The input string to be converted to title case. * @returns {string} - The string in title case. */ const toTitleCase = (str) => { return str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase() }) } export default toTitleCase