10 lines · 252 B · TypeScript
RawDownload
export function slugify(t: string): string {    return t        .toString()        .toLowerCase()        .replace(/\s+/g, "-")        .replace(/[^\w-]+/g, "")        .replace(/--+/g, "-")        .replace(/^-+/, "")        .replace(/-+$/, "")}