summaryrefslogtreecommitdiff
path: root/lib/util.ts
blob: 2c304613b5ee4777fe7352b82ebfeddf230afb84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * 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)

export const now = () => Date.now() / 1000