Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/pup/deps.ts>uuid.v4.validate

Universal process manager built in Deno
Go to Latest
function uuid.v4.validate
import { uuid } from "https://deno.land/x/pup@1.0.0-beta.25/deps.ts";
const { validate } = uuid.v4;

Validate that the passed UUID is an RFC4122 v4 UUID.

Examples

Example 1

import { validate } from "https://deno.land/std@0.224.0/uuid/v4.ts";
import { generate as generateV1 } from "https://deno.land/std@0.224.0/uuid/v1.ts";

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

Parameters

id: string

Returns

boolean