generate

import { generate } from "jsr:@ende/uuid/v7";

function

function generate(timestamp: number = [UNSUPPORTED]): string

Generates a UUIDv7.

All bits after the 48-bit timestamp are random, so UUIDs generated within the same millisecond do not sort in generation order: this implementation uses none of the optional monotonicity methods of RFC 9562 section 6.2.

timestamp: number = [UNSUPPORTED]

Unix Epoch timestamp in milliseconds.

Returns

Returns a UUIDv7 string

Example: Usage

import { generate, validate } from "@ende/uuid/v7";
import { assert } from "@ende/assert";

const uuid = generate();
assert(validate(uuid));

Source