Move toId to shared/utils/functions.ts
This commit is contained in:
parent
02be8a37a5
commit
262a691ed6
4 changed files with 8 additions and 13 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue