uslug
uslug copied to clipboard
Trailing `-` is Not Desired
https://runkit.com/embed/d6c7frrx3zob
const uslug = require("uslug");
uslug("Boom ❤️");
Expected: boom
Actual: boom-️
It happens because of \ufe0f which:
This codepoint may change the appearance of the preceding character. If that is a symbol, dingbat or emoji, U+FE0F forces it to be rendered as a colorful image as compared to a monochrome text variant.
The source To fix this I use:
const slugify = (text) =>
uslug(text).replace(/[-\ufe0f]+$/ug, '');