Files
Compass/_old/lib/format.ts
MartinBraquet 14c12ffb08 Rename
2025-09-18 11:19:09 +02:00

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(" ");
}