std/uuid/v4.ts

Deno standard library
Go to Latest
function validate
import { validate } from "https://deno.land/std@0.151.0/uuid/v4.ts?s=validate";

Validate that the passed UUID is an RFC4122 v4 UUID.

import { validate } from "./v4.ts";
import { generate as generateV1 } from "./v1.ts";

validate(crypto.randomUUID()); // true
validate(generateV1() as string); // false
validate("this-is-not-a-uuid"); // false

Parameters

id: string[src]