Files
Compass/lib/format.ts
MartinBraquet e6b9b3f9e0 Add capitalize
2025-08-02 16:19:43 +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(" ");
}