diff --git a/src/shared/utils/formattedText.ts b/src/shared/utils/formattedText.ts new file mode 100644 index 00000000..651faaed --- /dev/null +++ b/src/shared/utils/formattedText.ts @@ -0,0 +1,8 @@ +const formattedText = (text: string): string => + text + .trim() + .split(' ') + .map((word) => (word[0] ? word[0].toUpperCase() + word.slice(1).toLowerCase() : '')) + .join(' '); + +export default formattedText;