Echo JS 0.11.0

<~>
jklu 2044 days ago. link parent 1 point
NodeJS support...

const crypto = require("crypto");
function createUUID() {
  const fmt = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
  const rnd = Array.from(crypto.randomBytes(32)).map(n => n & 0xf);
  const rk = (c, r) => (c == "x" ? r : (r & 0x3) | 0x8).toString(16);
  return fmt.replace(/[xy]/g, c => rk(c, rnd.pop()));
}

Replies