aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/helper.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client-web/source/helper.ts')
-rw-r--r--client-web/source/helper.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/client-web/source/helper.ts b/client-web/source/helper.ts
index 49c36fa..336f7d4 100644
--- a/client-web/source/helper.ts
+++ b/client-web/source/helper.ts
@@ -84,3 +84,9 @@ export class EventEmitter<E> {
public add_listener(listener: (e: E) => unknown) { this.handlers.add(listener) }
public remove_listener(listener: (e: E) => unknown) { this.handlers.delete(listener) }
}
+
+export function array_swap<T>(arr: T[], a: number, b: number) {
+ const temp = arr[a]
+ arr[a] = arr[b]
+ arr[b] = temp
+} \ No newline at end of file