Skip to content
velt/random/uuid exports

velt/random/uuid

API reference

RFC 9562 UUIDs. The text form is lowercase 8-4-4-4-12; the binary form is 16 bytes in network order. For a walkthrough, read the guide.

import { uuidv4, uuidv7 } from "velt/random/uuid";

Exports

Re-exported from velt/random/uuid/uuid

function uuidParse(s: string): u8[]

The 16 bytes of a UUID in text form (either case). Throws UuidError if malformed.

function

uuidStringify

#std/random/uuid/uuid.vlt:72

Re-exported from velt/random/uuid/uuid

function uuidStringify(bytes: u8[]): string

The lowercase text form of 16 UUID bytes. Throws UuidError for any other length.

Re-exported from velt/random/uuid/uuid

function uuidv4(): string

A random (version 4) UUID.

Re-exported from velt/random/uuid/uuid

function uuidv7(): string

A time-ordered (version 7) UUID: 48-bit Unix milliseconds, then 74 random bits.

function

uuidValidate

#std/random/uuid/uuid.vlt:83

Re-exported from velt/random/uuid/uuid

function uuidValidate(s: string): bool

Whether s is a UUID in text form with an RFC 9562 version (1-8) and variant, or the nil / max UUID (like the uuid npm package's validate).

Re-exported from velt/random/uuid/uuid

function uuidVersion(s: string): i64

The version number (the 13th hex digit) of a well-formed UUID. Throws UuidError if s is not a UUID in text form.

Re-exported from velt/random/uuid/errors

class UuidError extends Error

Thrown for malformed UUID text or a byte array that is not 16 bytes long.

constructor(message: string)No doc comment yet

Re-exported from velt/random/uuid/uuid

const NIL_UUID = "00000000-0000-0000-0000-000000000000"

The all-zero UUID (RFC 9562 §5.9).