Home

Awesome

this list is now archived - look inside https://github.com/sw-yx/brain if you would like an updated list! thank you.

uuid-list

list of unique id implementations, design considerations, and resources. may also overlap somewhat with the topic of hashing

Desirable Properties

Concepts

Impls

grab n go: https://www.uuidgenerator.net/

super simple dumb unique id

function id () {
  return Math.random().toString(36).substring(2) + Date.now().toString(36);
}

better uuid?

https://www.w3resource.com/javascript-exercises/javascript-math-exercise-23.php
export function uuid() {
  var dt = new Date().getTime()
  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(
    c
  ) {
    var r = (dt + Math.random() * 16) % 16 | 0
    dt = Math.floor(dt / 16)
    // eslint-disable-next-line
    return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16)
  })
  return uuid
}