summaryrefslogtreecommitdiff
path: root/lib/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.ts')
-rw-r--r--lib/util.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/util.ts b/lib/util.ts
new file mode 100644
index 0000000..7e7b965
--- /dev/null
+++ b/lib/util.ts
@@ -0,0 +1,10 @@
+/**
+ * Get the last item in t
+ */
+export const last = <T>(t: T[]): T => t[t.length - 1];
+
+/**
+ * Generate a random key with a seed
+ */
+export const getKey = (seed: string) =>
+ seed + Date.now() + Math.floor(Math.random() * 1000);