next-firebase-course
next-firebase-course copied to clipboard
kebabcase doesn't filter emojis from the title
I was trying to imitate dev.to's posts full of emojis and I found this bug
The function does not filter Unicode emojis, which makes next.js unable to pre-render posts correctly due to the post slug
after some googling I found a simple solution to this
let str = "Hi! πΊπΊπΊπΊ Hello tomπ©βππ¨βπ»";
let regex = new RegExp(/\p{Emoji}/gu);
console.log(str.replace(regex, ""));
another solution might be the one supplied here Mozilla docs