validate

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

function

function validate(id: string): boolean

Determines whether a string is a valid UUIDv7.

id: string

UUID value.

Returns

true if the string is a valid UUIDv7, otherwise false.

Example: Usage

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

assert(validate("017f22e2-79b0-7cc3-98c4-dc0c0c07398f"));
assertFalse(validate("fac8c1e0-ad1a-4204-a0d0-8126ae84495d"));

Source