mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-29 14:48:47 +00:00
feat: add slug function
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
|||||||
|
import slug from "slugify";
|
||||||
|
|
||||||
|
export const slugify = (text: string | undefined) => {
|
||||||
|
if (!text) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const cleanedText = text.trim().replace(/[^a-zA-Z0-9\s]/g, "");
|
||||||
|
|
||||||
|
return slug(cleanedText, {
|
||||||
|
lower: true,
|
||||||
|
trim: true,
|
||||||
|
strict: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user