validate

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

function

function validate(uuid: string): boolean

Determines whether a string is a valid UUID.

uuid: string

UUID value.

Returns

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

Example: Usage

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

assert(validate("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"));
assertFalse(validate("not a UUID"));

Source