Generates RFC 9562 UUIDs in JavaScript and TypeScript
open sourceMITfree
uuid is the npm package for creating and handling RFC 9562 (formerly RFC 4122) UUIDs in JavaScript and TypeScript. It generates every version the RFC defines: v1 and v6 timestamps, v3 and v5 namespace UUIDs, random v4 and Unix-time v7, with helpers to parse, stringify, validate and detect a UUID's version and to convert between v1 and v6. It has no dependencies, is tree-shakable, takes its random values from the platform's crypto API, and runs in Node.js and modern browsers; a uuid command generates them from the shell.
Problems it solves
- generate a random unique id in JavaScript
- make time-ordered UUIDs I can sort by creation time in Node.js
- check whether a string is a valid UUID in the browser
Features
- Generates UUID versions 1, 3, 4, 5, 6 and 7
- Parses, stringifies and validates UUIDs and detects their version
- Converts between version 1 and version 6 UUIDs
- No dependencies and tree-shakable, with TypeScript types
- A uuid command line tool
Limitations
Alternatives
The same job
These do what uuid does.
- Nano ID Tiny, secure, URL-friendly unique string ID generator for JavaScript
