mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-15 00:45:04 +01:00
fix break
This commit is contained in:
parent
0bf9aed35e
commit
1dad80f4c1
6 changed files with 70 additions and 33 deletions
15
src/utils.ts
15
src/utils.ts
|
|
@ -1,3 +1,18 @@
|
|||
export function encodeUtf8(s: string): Uint8Array {
|
||||
return new TextEncoder().encode(s);
|
||||
}
|
||||
|
||||
export class Ids {
|
||||
nextId: number = 0;
|
||||
|
||||
public next(): number {
|
||||
return this.nextId++;
|
||||
}
|
||||
}
|
||||
|
||||
export function unwrap<T>(value: T | undefined): T {
|
||||
if (value === undefined) {
|
||||
throw new Error("tried to unwrap undefined value");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue