Move toId to shared/utils/functions.ts

This commit is contained in:
Hornwitser 2025-03-15 13:46:13 +01:00
parent 02be8a37a5
commit 262a691ed6
4 changed files with 8 additions and 13 deletions

View file

@ -6,6 +6,11 @@ export function* enumerate<T>(iterable: Iterable<T>) {
}
}
/** Converts a name to an id */
export function toId(name: string) {
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-");
}
/** Returns adjacent pairs from iterable */
export function* pairs<T>(iterable: Iterable<T>) {
let first;