Last active
September 2, 2021 21:10
-
-
Save IBRAHIMDANS/44efcd009fcc28fa4890bed454743c0e to your computer and use it in GitHub Desktop.
slugify
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 slugify = (world, separator = '-') => { | |
return world.toString() | |
.normalize('NFD') | |
.replace(/[\u0300-\u036f]/g, '') | |
.toLowerCase() | |
.trim() | |
.replace(/[^a-z0-9 ]/g, '') | |
.replace(/\s+/g, separator) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment