Slugify using Javascript

I needed to convert a text for this project that I'm working on. I have used several functions to do this using Javascript. But today I decided to take another look and this is the best solution for this task that I found on Github Create slug from string in Javascript

And here is the code if you want to implement it.

const slugify = text =>
    .replace(/[\u0300-\u036f]/g, '')
    .replace(/\s+/g, '-')
    .replace(/[^\w-]+/g, '')
    .replace(/--+/g, '-')

Victor Yoalli

This is me.