@technobuddha/library
Version:
A large library of useful functions
12 lines (11 loc) • 384 B
JavaScript
/**
* Convert the first letter of each word in a string to lower case
*
* @param input The string to make small case
* @default upperCase false
* @returns string in small case
*/
export function toSmallWordsCase(input, { upperCase = false } = {}) {
return (upperCase ? input.toUpperCase() : input).replace(/\b\w/ug, c => c.toLowerCase());
}
export default toSmallWordsCase;