2026-05-28 16:37:33 -04:00

17 lines
366 B
TypeScript

export function slugify(value: string) {
const slug = value
.toLowerCase()
.trim()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "")
.slice(0, 48);
return slug || "workspace";
}
export function toHex(value: string) {
return Array.from(new TextEncoder().encode(value), (byte) =>
byte.toString(16).padStart(2, "0"),
).join("");
}