Skip to content

Instantly share code, notes, and snippets.

@caio-ribeiro-pereira
Created December 27, 2018 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caio-ribeiro-pereira/0dfa07d6d34006b27aee736a8db83d21 to your computer and use it in GitHub Desktop.
Save caio-ribeiro-pereira/0dfa07d6d34006b27aee736a8db83d21 to your computer and use it in GitHub Desktop.
Criando slug strings usando regex
function slugify(content) {
return content.toLowerCase().replace(/\s/g, '-').trim();
}
slugify("Escrevendo JavaScript Melhor");
// "escrevendo-javascript-melhor"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment