Module

std/uuid/mod.ts>v5.validate

Deno standard library
Go to Latest
function v5.validate
import { v5 } from "https://dotland.deno.dev/std@0.131.0/uuid/mod.ts";
const { validate } = v5;

Validate that the passed UUID is an RFC4122 v5 UUID.

import { generate as generateV5, validate } from "./v5.ts";

validate(await generateV5("6ba7b810-9dad-11d1-80b4-00c04fd430c8", new Uint8Array())); // true
validate(crypto.randomUUID()); // false
validate("this-is-not-a-uuid"); // false

Parameters

id: string

Returns

boolean