-
-
Save hellokvn/b7d7da8e9d5405a7ca35f99f0e06eef6 to your computer and use it in GitHub Desktop.
slugify.ts
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 = (str: string): string => str.toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]+/g, ''); | |
slugify('Hello World'); // -> hello-world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment