Created
October 15, 2024 13:53
-
-
Save mhsattarian/0d10e397ca07a7bcce64ea72bcb66693 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const capitalize = (str?: string): string => { | |
if (!str) return ''; | |
return str.charAt(0).toUpperCase() + (str.slice(1).toLowerCase() ?? ''); | |
}; | |
export const humanReadbleSlug = (str: string) => | |
str.split('_').map(capitalize).join(' '); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment