Initial aishare service

This commit is contained in:
Codex
2026-07-06 11:25:57 +00:00
commit e051b568ab
23 changed files with 5615 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
const STOP_CHARS = /['"`]/g;
export function slugify(input: string, fallback = "chatgpt-share"): string {
const base = input
.normalize("NFKD")
.replace(STOP_CHARS, "")
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "")
.replace(/-{2,}/g, "-")
.slice(0, 80);
return base || fallback;
}
export function displayTitleFromSlug(slug: string): string {
return slug
.split("-")
.filter(Boolean)
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
.join(" ");
}