~cytrogen/masto-fe

ref: f89f3a85662ce1f4e6f130748ded22821e4a7acd masto-fe/app/javascript/mastodon/uuid.ts -rw-r--r-- 252 bytes
f89f3a85 — Claire Fix glitch-soc's thread line styling (#2214) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
export default function uuid(a?: string): string {
  return a
    ? (
      (a as any as number) ^
        ((Math.random() * 16) >> ((a as any as number) / 4))
    ).toString(16)
    : ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
}