Sign In

uuid

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuid - npm Package Compare versions

Comparing version
13.0.0
to
14.0.0
+2
-8
dist-node/rng.js

@@ -1,10 +0,4 @@

import { randomFillSync } from 'node:crypto';
const rnds8Pool = new Uint8Array(256);
let poolPtr = rnds8Pool.length;
const rnds8 = new Uint8Array(16);
export default function rng() {
if (poolPtr > rnds8Pool.length - 16) {
randomFillSync(rnds8Pool);
poolPtr = 0;
}
return rnds8Pool.slice(poolPtr, (poolPtr += 16));
return crypto.getRandomValues(rnds8);
}

@@ -29,3 +29,6 @@ import parse from './parse.js';

if (buf) {
offset = offset || 0;
offset ??= 0;
if (offset < 0 || offset + 16 > buf.length) {
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
}
for (let i = 0; i < 16; ++i) {

@@ -32,0 +35,0 @@ buf[offset + i] = bytes[i];

+6
-7

@@ -1,4 +0,9 @@

import native from './native.js';
import rng from './rng.js';
import { unsafeStringify } from './stringify.js';
function v4(options, buf, offset) {
if (!buf && !options && crypto.randomUUID) {
return crypto.randomUUID();
}
return _v4(options, buf, offset);
}
function _v4(options, buf, offset) {

@@ -24,8 +29,2 @@ options = options || {};

}
function v4(options, buf, offset) {
if (native.randomUUID && !buf && !options) {
return native.randomUUID();
}
return _v4(options, buf, offset);
}
export default v4;

@@ -10,2 +10,5 @@ import { unsafeStringify } from './stringify.js';

if (buf) {
if (offset < 0 || offset + 16 > buf.length) {
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
}
for (let i = 0; i < 16; i++) {

@@ -12,0 +15,0 @@ buf[offset + i] = bytes[i];

@@ -1,2 +0,1 @@

export type * from './types.js';
export { default as MAX } from './max.js';

@@ -6,2 +5,3 @@ export { default as NIL } from './nil.js';

export { default as stringify } from './stringify.js';
export type * from './types.js';
export { default as v1 } from './v1.js';

@@ -8,0 +8,0 @@ export { default as v1ToV6 } from './v1ToV6.js';

@@ -19,3 +19,3 @@ function md5(bytes) {

xpad.set(x);
xpad[len >> 5] |= 0x80 << len % 32;
xpad[len >> 5] |= 0x80 << (len % 32);
xpad[xpad.length - 1] = len;

@@ -22,0 +22,0 @@ x = xpad;

@@ -1,2 +0,3 @@

declare function parse(uuid: string): Uint8Array;
import type { NonSharedArrayBuffer } from './types.js';
declare function parse(uuid: string): NonSharedArrayBuffer;
export default parse;

@@ -1,11 +0,4 @@

let getRandomValues;
const rnds8 = new Uint8Array(16);
export default function rng() {
if (!getRandomValues) {
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
}
getRandomValues = crypto.getRandomValues.bind(crypto);
}
return getRandomValues(rnds8);
return crypto.getRandomValues(rnds8);
}

@@ -37,3 +37,3 @@ function f(s, x, y, z) {

}
M[N - 1][14] = ((bytes.length - 1) * 8) / Math.pow(2, 32);
M[N - 1][14] = ((bytes.length - 1) * 8) / 2 ** 32;
M[N - 1][14] = Math.floor(M[N - 1][14]);

@@ -40,0 +40,0 @@ M[N - 1][15] = ((bytes.length - 1) * 8) & 0xffffffff;

@@ -22,1 +22,2 @@ export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;

};
export type NonSharedArrayBuffer = ReturnType<typeof Uint8Array.of>;

@@ -1,2 +0,2 @@

import { Version1Options } from './types.js';
import type { Version1Options } from './types.js';
type V1State = {

@@ -3,0 +3,0 @@ node?: Uint8Array;

@@ -0,2 +1,3 @@

import type { NonSharedArrayBuffer } from './types.js';
export default function v1ToV6(uuid: string): string;
export default function v1ToV6(uuid: Uint8Array): Uint8Array;
export default function v1ToV6(uuid: Uint8Array): NonSharedArrayBuffer;

@@ -1,2 +0,2 @@

import { UUIDTypes } from './types.js';
import type { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';

@@ -3,0 +3,0 @@ declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;

@@ -1,2 +0,2 @@

import { UUIDTypes } from './types.js';
import type { UUIDTypes } from './types.js';
export declare function stringToBytes(str: string): Uint8Array;

@@ -3,0 +3,0 @@ export declare const DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";

@@ -29,3 +29,6 @@ import parse from './parse.js';

if (buf) {
offset = offset || 0;
offset ??= 0;
if (offset < 0 || offset + 16 > buf.length) {
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
}
for (let i = 0; i < 16; ++i) {

@@ -32,0 +35,0 @@ buf[offset + i] = bytes[i];

@@ -1,4 +0,4 @@

import { Version4Options } from './types.js';
import type { Version4Options } from './types.js';
declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v4;

@@ -1,4 +0,9 @@

import native from './native.js';
import rng from './rng.js';
import { unsafeStringify } from './stringify.js';
function v4(options, buf, offset) {
if (!buf && !options && crypto.randomUUID) {
return crypto.randomUUID();
}
return _v4(options, buf, offset);
}
function _v4(options, buf, offset) {

@@ -24,8 +29,2 @@ options = options || {};

}
function v4(options, buf, offset) {
if (native.randomUUID && !buf && !options) {
return native.randomUUID();
}
return _v4(options, buf, offset);
}
export default v4;

@@ -1,2 +0,2 @@

import { UUIDTypes } from './types.js';
import type { UUIDTypes } from './types.js';
export { DNS, URL } from './v35.js';

@@ -3,0 +3,0 @@ declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;

@@ -1,4 +0,4 @@

import { Version6Options } from './types.js';
import type { Version6Options } from './types.js';
declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
export default v6;

@@ -10,2 +10,5 @@ import { unsafeStringify } from './stringify.js';

if (buf) {
if (offset < 0 || offset + 16 > buf.length) {
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
}
for (let i = 0; i < 16; i++) {

@@ -12,0 +15,0 @@ buf[offset + i] = bytes[i];

@@ -1,2 +0,2 @@

import { Version7Options } from './types.js';
import type { Version7Options } from './types.js';
type V7State = {

@@ -3,0 +3,0 @@ msecs?: number;

{
"name": "uuid",
"version": "13.0.0",
"version": "14.0.0",
"description": "RFC9562 UUIDs",

@@ -40,31 +40,25 @@ "type": "module",

"devDependencies": {
"@babel/eslint-parser": "7.27.1",
"@commitlint/cli": "19.8.0",
"@commitlint/config-conventional": "19.8.0",
"@eslint/js": "9.26.0",
"@biomejs/biome": "2.4.10",
"@commitlint/cli": "20.5.0",
"@commitlint/config-conventional": "20.5.0",
"bundlewatch": "0.4.1",
"commander": "13.1.0",
"eslint": "9.26.0",
"eslint-config-prettier": "10.1.2",
"eslint-plugin-prettier": "5.4.0",
"globals": "16.0.0",
"commander": "14.0.3",
"globals": "17.4.0",
"husky": "9.1.7",
"jest": "29.7.0",
"lint-staged": "15.5.2",
"neostandard": "0.12.1",
"npm-run-all": "4.1.5",
"prettier": "3.5.3",
"release-please": "17.0.0",
"jest": "30.3.0",
"lint-staged": "16.4.0",
"neostandard": "0.13.0",
"npm-run-all2": "8.0.4",
"release-please": "17.3.0",
"runmd": "1.4.1",
"standard-version": "9.5.0",
"typescript": "5.2.2",
"typescript-eslint": "8.32.0"
"typescript": "5.4.3"
},
"optionalDevDependencies": {
"@wdio/browserstack-service": "9.2.1",
"@wdio/cli": "9.2.1",
"@wdio/jasmine-framework": "9.2.1",
"@wdio/local-runner": "9.2.1",
"@wdio/spec-reporter": "9.1.3",
"@wdio/static-server-service": "9.1.3"
"@wdio/browserstack-service": "9.27.0",
"@wdio/cli": "9.27.0",
"@wdio/jasmine-framework": "9.27.0",
"@wdio/local-runner": "9.27.0",
"@wdio/spec-reporter": "9.27.0",
"@wdio/static-server-service": "9.27.0"
},

@@ -77,4 +71,4 @@ "scripts": {

"docs": "npm run build && npx runmd --output=README.md README_js.md",
"eslint:check": "eslint src/ test/ examples/ *.[jt]s",
"eslint:fix": "eslint --fix src/ test/ examples/ *.[jt]s",
"biome:check": "biome check .",
"biome:fix": "biome check --write .",
"examples:browser:rollup:build": "cd examples/browser-rollup && npm run build",

@@ -85,3 +79,3 @@ "examples:browser:webpack:build": "cd examples/browser-webpack && npm run build",

"examples:node:typescript:test": "cd examples/typescript && npm test",
"lint": "npm run eslint:check && npm run prettier:check",
"lint": "npm run biome:check",
"md": "runmd --watch --output=README.md README_js.md",

@@ -95,4 +89,4 @@ "prepack": "npm run build -- --no-pack",

"pretest": "npm run build",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"format": "biome format --write .",
"format:check": "biome format --check .",
"release": "standard-version --no-verify",

@@ -111,6 +105,3 @@ "test:benchmark": "cd examples/benchmark && npm test",

"*": [
"prettier --no-error-on-unmatched-pattern --write"
],
"*.{js,jsx}": [
"eslint --no-error-on-unmatched-pattern --fix"
"biome check --write --no-errors-on-unmatched"
]

@@ -120,6 +111,6 @@ },

"scripts": {
"postchangelog": "prettier --write CHANGELOG.md"
"postchangelog": "biome format --write CHANGELOG.md"
}
},
"packageManager": "npm@11.3.0"
"packageManager": "npm@11.12.1"
}
+100
-108

@@ -35,5 +35,5 @@ <!--

```javascript
import { v4 as uuidv4 } from 'uuid';
import { v4 as uuidv4 } from "uuid";
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
uuidv4(); // ⇨ 'ab16e731-6cee-424d-81a0-5929e9bdb0cc'
```

@@ -45,19 +45,19 @@

| | | |
| --- | --- | --- |
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | |
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | |
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | |
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | |
| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" | |
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |
| | | |
| -------------------------------------------------- | ----------------------------------------------- | ----------------- |
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | |
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | |
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | |
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | |
| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" | |
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |

@@ -73,3 +73,3 @@ ## API

```javascript
import { NIL as NIL_UUID } from 'uuid';
import { NIL as NIL_UUID } from "uuid";

@@ -86,3 +86,3 @@ NIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000'

```javascript
import { MAX as MAX_UUID } from 'uuid';
import { MAX as MAX_UUID } from "uuid";

@@ -109,6 +109,6 @@ MAX_UUID; // ⇨ 'ffffffff-ffff-ffff-ffff-ffffffffffff'

```javascript
import { parse as uuidParse } from 'uuid';
import { parse as uuidParse } from "uuid";
// Parse a UUID
uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨
uuidParse("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"); // ⇨
// Uint8Array(16) [

@@ -140,3 +140,3 @@ // 110, 192, 189, 127, 17,

```javascript
import { stringify as uuidStringify } from 'uuid';
import { stringify as uuidStringify } from "uuid";

@@ -159,3 +159,3 @@ const uuidBytes = Uint8Array.of(

0xae,
0x0b
0x0b,
);

@@ -170,30 +170,22 @@

| | |
| --- | --- |
| [`options`] | `Object` with one or more of the following properties: |
| [`options.node = (random)` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) |
| [`options.clockseq = (random)`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff |
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
| [`options.nsecs = 0`] | RFC "timestamp" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) |
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
| _throws_ | `Error` if more than 10M UUIDs/sec are requested |
| | |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| [`options`] | `Object` with one or more of the following properties: |
| [`options.node = (random)` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) |
| [`options.clockseq = (random)`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff |
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
| [`options.nsecs = 0`] | RFC "timestamp" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) |
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
| _throws_ | `Error` if more than 10M UUIDs/sec are requested |
<!-- prettier-ignore -->
> [!NOTE]
> The default [node id](https://datatracker.ietf.org/doc/html/rfc9562#section-5.1) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.
<!-- prettier-ignore -->
> [!NOTE]
> `options.random` and `options.rng` are only meaningful on the very first call to `v1()`, where they may be passed to initialize the internal `node` and `clockseq` fields.
Example:
```javascript
import { v1 as uuidv1 } from 'uuid';
import { v1 as uuidv1 } from "uuid";
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-9b5d-ab8dfbbd4bed'
uuidv1(); // ⇨ '4d9d2960-31d0-11f1-aba8-29728d41eeed'
```

@@ -204,3 +196,3 @@

```javascript
import { v1 as uuidv1 } from 'uuid';
import { v1 as uuidv1 } from "uuid";

@@ -210,3 +202,3 @@ const options = {

clockseq: 0x1234,
msecs: new Date('2011-11-01').getTime(),
msecs: new Date("2011-11-01").getTime(),
nsecs: 5678,

@@ -222,5 +214,5 @@ };

```javascript
import { v1ToV6 } from 'uuid';
import { v1ToV6 } from "uuid";
v1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'
v1ToV6("92f62d9e-22c4-11ef-97e9-325096b39f47"); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'
```

@@ -242,10 +234,10 @@

| | |
| --- | --- |
| [`options`] | `Object` with one or more of the following properties: |
| [`options.random`] | `Array` of 16 random bytes (0-255) |
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
| | |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| [`options`] | `Object` with one or more of the following properties: |
| [`options.random`] | `Array` of 16 random bytes (0-255) |
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |

@@ -255,5 +247,5 @@ Example:

```javascript
import { v4 as uuidv4 } from 'uuid';
import { v4 as uuidv4 } from "uuid";
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
uuidv4(); // ⇨ '7934256a-bc92-4b69-b240-f9e463881aea'
```

@@ -264,3 +256,3 @@

```javascript
import { v4 as uuidv4 } from 'uuid';
import { v4 as uuidv4 } from "uuid";

@@ -284,3 +276,3 @@ const v4options = {

0x58,
0x36
0x36,
),

@@ -295,9 +287,9 @@ };

| | |
| --- | --- |
| `name` | `String \| Array` |
| `namespace` | `String \| Array[16]` Namespace UUID |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
| | |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `name` | `String \| Array` |
| `namespace` | `String \| Array[16]` Namespace UUID |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |

@@ -311,9 +303,9 @@ <!-- prettier-ignore -->

```javascript
import { v5 as uuidv5 } from 'uuid';
import { v5 as uuidv5 } from "uuid";
// Define a custom namespace. Readers, create your own using something like
// https://www.uuidgenerator.net/
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
const MY_NAMESPACE = "1b671a64-40d5-491e-99b0-da01ff1f3341";
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
uuidv5("Hello, World!", MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
```

@@ -324,5 +316,5 @@

```javascript
import { v5 as uuidv5 } from 'uuid';
import { v5 as uuidv5 } from "uuid";
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
uuidv5("https://www.w3.org/", uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
```

@@ -337,5 +329,5 @@

```javascript
import { v6 as uuidv6 } from 'uuid';
import { v6 as uuidv6 } from "uuid";
uuidv6(); // ⇨ '1e940672-c5ea-64c1-9bdd-2b0d7b3dcb6d'
uuidv6(); // ⇨ '1f131d04-d9dc-65a0-9516-5be66631ce97'
```

@@ -346,3 +338,3 @@

```javascript
import { v6 as uuidv6 } from 'uuid';
import { v6 as uuidv6 } from "uuid";

@@ -352,3 +344,3 @@ const options = {

clockseq: 0x1234,
msecs: new Date('2011-11-01').getTime(),
msecs: new Date("2011-11-01").getTime(),
nsecs: 5678,

@@ -364,5 +356,5 @@ };

```javascript
import { v6ToV1 } from 'uuid';
import { v6ToV1 } from "uuid";
v6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'
v6ToV1("1ef22c49-2f62-6d9e-97e9-325096b39f47"); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'
```

@@ -374,12 +366,12 @@

| | |
| --- | --- |
| [`options`] | `Object` with one or more of the following properties: |
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help ensure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
| | |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`options`] | `Object` with one or more of the following properties: |
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help ensure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |

@@ -389,5 +381,5 @@ Example:

```javascript
import { v7 as uuidv7 } from 'uuid';
import { v7 as uuidv7 } from "uuid";
uuidv7(); // ⇨ '01695553-c90c-745a-b76f-770d7b3dcb6d'
uuidv7(); // ⇨ '019d637c-c6fb-74e9-8b9d-2f1d459a4201'
```

@@ -415,6 +407,6 @@

```javascript
import { validate as uuidValidate } from 'uuid';
import { validate as uuidValidate } from "uuid";
uuidValidate('not a UUID'); // ⇨ false
uuidValidate('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ true
uuidValidate("not a UUID"); // ⇨ false
uuidValidate("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"); // ⇨ true
```

@@ -425,4 +417,4 @@

```javascript
import { version as uuidVersion } from 'uuid';
import { validate as uuidValidate } from 'uuid';
import { version as uuidVersion } from "uuid";
import { validate as uuidValidate } from "uuid";

@@ -433,4 +425,4 @@ function uuidValidateV4(uuid) {

const v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210';
const v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836';
const v1Uuid = "d9428888-122b-11e1-b85c-61cd3cbb3210";
const v4Uuid = "109156be-c4fb-41ea-b1b4-efe1671c5836";

@@ -454,6 +446,6 @@ uuidValidateV4(v4Uuid); // ⇨ true

```javascript
import { version as uuidVersion } from 'uuid';
import { version as uuidVersion } from "uuid";
uuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1
uuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4
uuidVersion("45637ec4-c85f-11ea-87d0-0242ac130003"); // ⇨ 1
uuidVersion("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"); // ⇨ 4
```

@@ -503,3 +495,3 @@

**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. At the time of this writing `node@20` is the "maintenance" release and `node@24` is the "current" release, so `uuid` supports `node@18`-`node@24`.
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. At the time of this writing `node@20` is the "maintenance" release and `node@24` is the "current" release, so `uuid` supports `node@20`-`node@24`.

@@ -510,3 +502,3 @@ **Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)

<!-- This header is referenced as an anchor in src/rng-browser.ts -->
<!-- This header is referenced as an anchor in src/rng.ts -->

@@ -523,4 +515,4 @@ ### "getRandomValues() not supported"

```javascript
import 'react-native-get-random-values';
import { v4 as uuidv4 } from 'uuid';
import "react-native-get-random-values";
import { v4 as uuidv4 } from "uuid";
```

@@ -527,0 +519,0 @@

import { randomUUID } from 'node:crypto';
export default { randomUUID };
declare const _default: {
randomUUID: false | (() => `${string}-${string}-${string}-${string}-${string}`);
};
export default _default;
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
export default { randomUUID };