s-melnikov
10/23/2017 - 8:02 AM

Test

Test

const CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

const uniqid = () => {
  let now = Date.now(), chars = [], i = 8, id
  while (i--) {
    chars[i] = CHARS.charAt(now % 64)
    now = Math.floor(now / 64)
  }
  id = chars.join("")
  while (i++ < 8) {
    id += CHARS.charAt(Math.floor(Math.random() * 64))
  }
  return id
}