10 lines
248 B
TypeScript
10 lines
248 B
TypeScript
export default function lowerToTitleCase(str: string) {
|
|
return str
|
|
.replace(/_|-/g, " ")
|
|
.split(" ")
|
|
.map(
|
|
(word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
|
|
)
|
|
.join(" ");
|
|
}
|