The `uuid4` package provides a lightweight and focused Node.js module specifically for generating and validating Version 4 UUIDs (Universally Unique Identifiers). As of its current stable version, 2.0.3, the library has shifted its compatibility focus to modern JavaScript environments, notably discontinuing support for legacy browsers that was available in its 1.x release line. This change means version 2.x and above are primarily designed for Node.js and modern browser environments that fully support ECMAScript Modules (ESM). While an explicit release cadence isn't detailed, the semantic versioning indicates a pattern of incremental updates and patch fixes. A key characteristic of `uuid4` is its simplicity for V4 generation. However, for users within the Deno ecosystem, the project itself recommends utilizing Deno's standard library UUID module for better native integration, highlighting a pragmatic approach to platform-specific best practices. The library offers a straightforward API for both creating new UUIDs and confirming the validity of existing ones against the RFC 4122 V4 specification.
npm install uuid4Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to generate a new V4 UUID and validate both generated and arbitrary UUID strings.
For modern browser/Node.js environments, upgrade to `uuid4@2.x`. For legacy browser support, pin your dependency to `uuid4@1.x`.
Always use `import uuid4 from 'uuid4';` in your code. Ensure your Node.js project is configured for ESM (e.g., via `"type": "module"` in `package.json` or using `.mjs` file extensions).
In Deno, use `import { v4 as uuid4 } from 'https://deno.land/std/uuid/mod.ts';` for UUID generation and validation.Change your import statement to `import uuid4 from 'uuid4';` and ensure your environment supports ESM (e.g., `"type": "module"` in `package.json`).
To enable ESM, add `"type": "module"` to your `package.json` or rename your file to use the `.mjs` extension. Alternatively, if you must use CommonJS, you may need to rely on `uuid4@1.x` or adjust your build pipeline.
For direct browser usage without a build step, import the browser-specific ESM bundle: `import uuid4 from 'https://cdn.jsdelivr.net/gh/tracker1/node-uuid4/browser.mjs';`
No dependency data recorded yet.