@malted/unique
v1.2.4
Published
A Typescript UUID v4 implementation
Downloads
3
Readme
unique - Node branch
A Typescript UUID v4 implementation
Usage
Import the module
Deno
import { uuid as uuidv4 } from "https://deno.land/x/unique/uuid.ts"
Node
npm install @malted/unique
const uuid4 = require('@malted/unique');
Generate a UUID
const uuid: string = uuidv4();
console.log(uuid);
Validate the generated UUID
import { v4 } from "https://deno.land/[email protected]/uuid/mod.ts";
const isValid: boolean = v4.validate(uuid);
console.log(isValid);
Why
As per the MDN docs, Crypto.randomUUID()
is available only in secure contexts
(HTTPS), in some or all supporting browsers.