@malted/unique
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

unique - Node branch

A Typescript UUID v4 implementation

Github branch

GitHub Workflow Status GitHub top language

GitHub tag (latest by date) npm (scoped)

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/std@0.112.0/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.

/@malted/unique/

    Package Sidebar

    Install

    npm i @malted/unique

    Weekly Downloads

    1

    Version

    1.2.4

    License

    MIT

    Unpacked Size

    5.26 kB

    Total Files

    6

    Last publish

    Collaborators

    • malted