Files
oak-gpui/styles/src/utils/slugify.ts
T
Nate Butler bfdd0824e2 Resolve TS errors and warnings
TODO: Use StyleTree types to remove `any`s from styleTrees.
2023-06-28 17:54:36 -04:00

11 lines
252 B
TypeScript

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