Last active
February 22, 2016 19:18
-
-
Save erikjung/0540eb9d2dabbd6f0967 to your computer and use it in GitHub Desktop.
toTitle
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
const toTitle = str => { | |
return str.split(/[\W_]+/) | |
.map(word => word.replace(/^\w/, first => first.toUpperCase())) | |
.join(' ') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment