@stephen-shopopop/uuidv5

Minimal node version Minimal npm version Maintenance Linux macOS Visual Studio Code

UUIDv5 generator

Description

Generate uuidv5 RFC4122

    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

Minimal node version

Add .npmrc file in your repository

@stephen-shopopop:registry=https://npm.pkg.github.com

npm install @stephen-shopopop/uuidv5@latest

Usage

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

const crypto = require('crypto')

// typescript
// import crypto from 'crypto'

const myUUID = crypto.randomUUID()

Contributing

  1. npm run build - Build library.
  2. npm run start - start project
  3. npm run test - Run test with jest.
  4. npm run lint - Lint your code.
  5. npm run lint:fix - Lint & fix your code.
  6. npm run typecheck - Run typescript check.
  7. npm run doc - Generate html doc.
  8. npm run release - Release library
  9. npm run fix - Fix library

Package maintenance

A modern cli tool that keeps your deps fresh

npx taze

Generated using TypeDoc