diff --git a/lib/format.ts b/lib/format.ts new file mode 100644 index 00000000..67b0e882 --- /dev/null +++ b/lib/format.ts @@ -0,0 +1,12 @@ +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(" "); +} \ No newline at end of file