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

7 lines
174 B
TypeScript
Raw Normal View History

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