-
-
Save 6ewis/7a0d7bd7f489a3d0be42ecf2231d2864 to your computer and use it in GitHub Desktop.
Ramda Title 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
import R from 'ramda'; | |
const capitalize = | |
R.converge( | |
R.concat(), | |
[ | |
R.compose( | |
R.toUpper, | |
R.head | |
), | |
R.tail, | |
] | |
); | |
const toTitleCase = | |
R.compose( | |
R.join(' '), | |
R.map(capitalize), | |
R.split(' ') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment