https://github.com/malted/unique
A Typescript UUID v4 implementation
https://github.com/malted/unique
uuid uuid-v4
Last synced: 4 months ago
JSON representation
A Typescript UUID v4 implementation
- Host: GitHub
- URL: https://github.com/malted/unique
- Owner: malted
- License: mit
- Created: 2021-10-20T00:51:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-17T16:11:07.000Z (over 3 years ago)
- Last Synced: 2025-12-31T01:53:28.470Z (6 months ago)
- Topics: uuid, uuid-v4
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unique
## A Typescript UUID v4 implementation
### Usage
#### Import the module
##### Deno
```js
import { uuid as uuidv4 } from "https://deno.land/x/unique/uuid.ts"
```
#### Generate a UUID
```js
const uuid: string = uuidv4();
console.log(uuid);
```
#### Validate the generated UUID
```js
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_.