diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-01-20 13:41:18 -0800 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-01-20 13:41:18 -0800 |
commit | 638ff4686f557a2f9c31c521d849360fc906ca52 (patch) | |
tree | 94af62a10f561f0438c74707d5a74221b2db1662 /src | |
parent | 2884398e52e7fb3fb12ea7b39e4fbfee18ac3b49 (diff) |
Implement helper to generate random key
Diffstat (limited to 'src')
-rw-r--r-- | src/util.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util.ts b/src/util.ts index abbf44d..7e7b965 100644 --- a/src/util.ts +++ b/src/util.ts @@ -2,3 +2,9 @@ * 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); |