rickvanlieshout.com/internal/gatsby/utils/to-kebab-case.ts
2022-04-16 14:53:32 +00:00

11 lines
197 B
TypeScript

const toKebabCase = (str: string = ""): string =>
str
.toLowerCase()
.replace(/[^\w\s]/gi, "")
.split(" ")
.join("-")
.split("_")
.join("-");
export default toKebabCase;