@knownasrazi/uuid
v1.0.0
Published
RFC4122 v1, v3, v4, v5 UUIDs: generate, validate, parse and stringify.
Maintainers
Readme
uuid
RFC4122 v1, v3, v4, v5 — generate, validate, parse.
Zero dependencies - ~2 KB gzipped - TypeScript - Node + Bun + browser
Install
bun add @knownasrazi/uuid
npm install @knownasrazi/uuidUsage
import { v1, v4, v5, validate, version } from "@knownasrazi/uuid";
v4(); // "3e1b9a5e-..."
v1(); // time-based
await v5("hello", "6dc980a0-bcbf-11e3-baa7-0800200c9a66");
validate("not-a-uuid"); // false
version(v4()); // 4API
| Export | Signature |
| --- | --- |
| v4() | () => string |
| v1() | () => string |
| v3(name, ns) | async (string, string|Uint8Array) => string |
| v5(name, ns) | async (string, string|Uint8Array) => string |
| validate(uuid) | (string) => boolean |
| version(uuid) | (string) => 1|3|4|5 |
v3 uses MD5, v5 uses SHA-1.
Development
git clone https://github.com/knownasrazi/uuid.git
cd uuid
bun install
bun test
bun run build
bun run lintLicense
uuid - uuids without the vendor.
