Skip to content

Instantly share code, notes, and snippets.

@hellokvn
Created Mar 7, 2022
Embed
What would you like to do?
slugify.ts
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