Files
cli/src/utils/slug.ts
2024-06-12 23:01:46 -06:00

15 lines
268 B
TypeScript

import slug from "./slugify.js";
export const slugify = (text: string | undefined) => {
if (!text) {
return "";
}
const cleanedText = text.trim().replaceAll(/[^\d\sA-Za-z]/g, "");
return slug(cleanedText, {
lower: true,
strict: true,
trim: true,
});
};