Last active
January 1, 2023 17:09
-
-
Save Asraf2asif/69ec9443a97b7bc3dbc05d593716bc8e to your computer and use it in GitHub Desktop.
Additional JS String Case
This file contains 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 capitalCase = (str) => | |
str && | |
str.toString().charAt(0).toUpperCase() | |
+ str.toString().slice(1).toLowerCase(); | |
export const properCase = (str) => | |
str && | |
str | |
.toString() | |
.split(' ') | |
.map((word) => capitalCase(word)) | |
.join(' '); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment