You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
243 B
13 lines
243 B
export default function sluggify(s: string): string {
|
|
let out = "";
|
|
|
|
for (const c of s.toLocaleLowerCase()) {
|
|
if (c >= 'a' && c <= 'z') {
|
|
out += c;
|
|
} else if (!":'".includes(c)) {
|
|
out += "-";
|
|
}
|
|
}
|
|
|
|
return out;
|
|
}
|