chore: rename utils package to shared

This commit is contained in:
Henry
2025-01-29 16:21:30 +00:00
parent 8addf952a9
commit 34f8ad4def
26 changed files with 96 additions and 80 deletions

View File

@@ -0,0 +1,8 @@
export function generateSlug(text: string): string {
return text
.toLowerCase()
.trim()
.replace(/[^\w\s-]/g, "") // Remove special characters
.replace(/\s+/g, "-") // Replace spaces with hyphens
.replace(/-+/g, "-"); // Remove consecutive hyphens
}

View File

@@ -0,0 +1,10 @@
import { customAlphabet } from "nanoid";
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
const length = 12;
const nanoid = customAlphabet(alphabet, length);
export function generateUID() {
return nanoid();
}

View File

@@ -0,0 +1,2 @@
export * from "./generateUID";
export * from "./generateSlug";