rickvanlieshout.com/internal/gatsby/utils/to-kebab-case.ts

11 lines
197 B
TypeScript
Raw Normal View History

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