https://github.com/stephen-shopopop/uuidv5
uuidv5 generator
https://github.com/stephen-shopopop/uuidv5
nodejs typescript
Last synced: 4 months ago
JSON representation
uuidv5 generator
- Host: GitHub
- URL: https://github.com/stephen-shopopop/uuidv5
- Owner: stephen-shopopop
- Created: 2022-07-30T19:50:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-31T17:30:05.000Z (almost 3 years ago)
- Last Synced: 2023-03-05T23:44:29.399Z (over 2 years ago)
- Topics: nodejs, typescript
- Language: TypeScript
- Homepage: https://stephen-shopopop.github.io/uuidv5/
- Size: 452 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[](https://nodejs.org/about/releases/)
[](https://github.com/npm/cli/releases)
[](https://GitHub.com/stephen-shopopop/node-ts/graphs/commit-activity)
[](https://svgshare.com/i/Zhy.svg)
[](https://svgshare.com/i/ZjP.svg)
[](https://code.visualstudio.com/)# UUIDv5 generator
## Description
Generate uuidv5 [RFC4122](https://datatracker.ietf.org/doc/html/rfc4122)
```bash
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_low |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| time_mid | time_hi_and_version |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|clk_seq_hi_res | clk_seq_low | node (0-1) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| node (2-5) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```### Installation
[](https://nodejs.org/about/releases/)
Add .npmrc file in your repository
> @stephen-shopopop:registry=https://npm.pkg.github.com
```bash
npm install @stephen-shopopop/uuidv5@latest
```## Usage
```ts
import uuidv5 from "uuidv5";const data = new TextEncoder().encode("Hello World!");
// Generate a v5 UUID using a namespace and some data.
const myUUID = uuidv5.generate("6ba7b810-9dad-11d1-80b4-00c04fd430c8", data);// Validate the v5 UUID.
const isValid = uuidv5.validate(myUUID);
```## UUIDv4
Generate uuidv4 with nodejs > 14 [crypto.randomuuid](https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_crypto_randomuuid_options)
```js
const crypto = require('crypto')// typescript
// import crypto from 'crypto'const myUUID = crypto.randomUUID()
```## Contributing
1. npm run build - Build library.
2. npm run test - Run test with jest.
3. npm run lint - Lint your code.
4. npm run lint:fix - Lint & fix your code.
5. npm run typecheck - Run typescript check.
6. npm run doc - Generate html doc.
7. npm run release - Release library
8. npm run fix - Fix library### Package maintenance
A modern cli tool that keeps your deps fresh
```bash
npx taze
```