diff options
Diffstat (limited to 'std/uuid/v4.ts')
-rw-r--r-- | std/uuid/v4.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/std/uuid/v4.ts b/std/uuid/v4.ts index f338440f5..1245f2678 100644 --- a/std/uuid/v4.ts +++ b/std/uuid/v4.ts @@ -6,10 +6,15 @@ const UUID_RE = new RegExp( "i", ); +/** + * Validates the UUID v4 + * @param id UUID value + */ export function validate(id: string): boolean { return UUID_RE.test(id); } +/** Generates a RFC4122 v4 UUID (pseudo-randomly-based) */ export function generate(): string { const rnds = crypto.getRandomValues(new Uint8Array(16)); |