Files
blog/src/lib/utils.js
2023-08-19 12:45:02 -07:00

9 lines
199 B
JavaScript

const nonAlphaNum = /[^A-Za-z0-9\-]/g;
const space = /\s+/g;
export function makeSlug(text) {
return text
.toLowerCase()
.replace(space, '-')
.replace(nonAlphaNum, '');
}