mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-01-02 02:48:02 -05:00
12 lines
251 B
TypeScript
12 lines
251 B
TypeScript
function capitalizeOne(str: string) {
|
|
if (!str) return "";
|
|
return str[0].toUpperCase() + str.slice(1).toLowerCase();
|
|
}
|
|
|
|
|
|
export function capitalize(str: string) {
|
|
return str
|
|
.split(" ")
|
|
.map(word => capitalizeOne(word))
|
|
.join(" ");
|
|
} |