mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: add slug function
This commit is contained in:
15
lib/slug.ts
Normal file
15
lib/slug.ts
Normal file
@@ -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