Skip to main content
Module

x/uuid7/mod.ts>v7

Generate UUIDv7 identifiers in JavaScript (or TypeScript)
Latest
variable v7
import { v7 } from "https://deno.land/x/uuid7@v0.0.1/mod.ts";

Generate a UUIDv7.

Options

To generate a UUID at a specific time, you can pass a number timestamp or Date object to this function.

You can also further customize UUID generation by providing an object with your preferences:

  • time: Generate with this time instead of the current system time. You can provide a number millisecond-precision UNIX timestamp (as Date.now returns), a Date object, or a function returning a number timestamp.
  • dashes: true to include - characters in the generated UUID string; false to omit them. (default: true)
  • upper: Capitalize the A-F characters in the UUID. (default: false)
  • version: The value of the UUID version field (default: 7)
  • entropy: A function to generate the random part of the UUID. Must return a Uint8Array containing 10 bytes. (default: uses crypto.getRandomValues)