Created
December 27, 2018 15:59
-
-
Save caio-ribeiro-pereira/0dfa07d6d34006b27aee736a8db83d21 to your computer and use it in GitHub Desktop.
Criando slug strings usando regex
This file contains hidden or 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
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