const TOTITLECASE = /[A-Za-zÀ-ÖØ-öø-ÿ]\S*/g ; const titleCaseVariants = { textchannel : 'TextChannel' , voicechannel : 'VoiceChannel' , categorychannel : 'CategoryChannel' , guildmember : 'GuildMember' } ; description param str terms export function toTitleCase ( str ) { return str . replace ( TOTITLECASE , ( txt ) => titleCaseVariants [ txt ] || txt . charAt ( 0 ) . toUpperCase ( ) + txt . substr ( 1 ) . toLowerCase ( ) ) ; }