Skip to content

Instantly share code, notes, and snippets.

@OrderAndCh4oS
Created September 25, 2024 23:55
Show Gist options
  • Select an option

  • Save OrderAndCh4oS/518faeb2d851955e1e409210cdb2b48a to your computer and use it in GitHub Desktop.

Select an option

Save OrderAndCh4oS/518faeb2d851955e1e409210cdb2b48a to your computer and use it in GitHub Desktop.

Revisions

  1. OrderAndCh4oS created this gist Sep 25, 2024.
    9 changes: 9 additions & 0 deletions slugify.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    const slugify = (str: string) => str
    .normalize("NFD")
    .replace(/[^\w\s]/g, '')
    .trim()
    .replace(/\s+/g, '-')
    .toLowerCase()
    ;

    console.log(slugify(' Blhä+ LFgha+áaf. asfaASF aFsfsf. '));