Skip to content

Instantly share code, notes, and snippets.

@erikjung
Last active February 22, 2016 19:18
Show Gist options
  • Save erikjung/0540eb9d2dabbd6f0967 to your computer and use it in GitHub Desktop.
Save erikjung/0540eb9d2dabbd6f0967 to your computer and use it in GitHub Desktop.
toTitle
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