+10
-6
| { | ||
| "name": "uuid", | ||
| "version": "14.0.0", | ||
| "version": "14.0.1", | ||
| "description": "RFC9562 UUIDs", | ||
@@ -29,3 +29,6 @@ "type": "module", | ||
| ".": { | ||
| "node": "./dist-node/index.js", | ||
| "node": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist-node/index.js" | ||
| }, | ||
| "default": "./dist/index.js" | ||
@@ -47,9 +50,10 @@ }, | ||
| "globals": "17.4.0", | ||
| "husky": "9.1.7", | ||
| "jest": "30.3.0", | ||
| "lefthook": "1.11.13", | ||
| "lint-staged": "16.4.0", | ||
| "neostandard": "0.13.0", | ||
| "npm-run-all2": "8.0.4", | ||
| "prettier": "3.8.3", | ||
| "release-please": "17.3.0", | ||
| "runmd": "1.4.1", | ||
| "runmd": "2.1.1", | ||
| "standard-version": "9.5.0", | ||
@@ -70,3 +74,3 @@ "typescript": "5.4.3" | ||
| "bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json", | ||
| "docs:diff": "npm run docs && git diff --quiet -I \"[0-9a-f-]{36}\" README.md", | ||
| "docs:diff": "npm run docs && git diff README.md", | ||
| "docs": "npm run build && npx runmd --output=README.md README_js.md", | ||
@@ -83,3 +87,3 @@ "biome:check": "biome check .", | ||
| "prepack": "npm run build -- --no-pack", | ||
| "prepare": "husky", | ||
| "prepare": "lefthook install", | ||
| "prepublishOnly": "npm run build", | ||
@@ -86,0 +90,0 @@ "pretest:benchmark": "npm run build", |
+99
-99
@@ -35,5 +35,5 @@ <!-- | ||
| ```javascript | ||
| import { v4 as uuidv4 } from "uuid"; | ||
| import { v4 as uuidv4 } from 'uuid'; | ||
| uuidv4(); // ⇨ 'ab16e731-6cee-424d-81a0-5929e9bdb0cc' | ||
| uuidv4(); // ⇨ 'b18794e8-5d0d-417c-b361-ba38e78411b4' | ||
| ``` | ||
@@ -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,15 +170,15 @@ | ||
| | | | | ||
| | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | [`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 | | ||
@@ -188,5 +188,5 @@ Example: | ||
| ```javascript | ||
| import { v1 as uuidv1 } from "uuid"; | ||
| import { v1 as uuidv1 } from 'uuid'; | ||
| uuidv1(); // ⇨ '4d9d2960-31d0-11f1-aba8-29728d41eeed' | ||
| uuidv1(); // ⇨ '57fd0000-c7d3-11ef-841d-514d2167fc5b' | ||
| ``` | ||
@@ -197,3 +197,3 @@ | ||
| ```javascript | ||
| import { v1 as uuidv1 } from "uuid"; | ||
| import { v1 as uuidv1 } from 'uuid'; | ||
@@ -203,3 +203,3 @@ const options = { | ||
| clockseq: 0x1234, | ||
| msecs: new Date("2011-11-01").getTime(), | ||
| msecs: new Date('2011-11-01').getTime(), | ||
| nsecs: 5678, | ||
@@ -215,5 +215,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' | ||
| ``` | ||
@@ -235,10 +235,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` | | ||
@@ -248,5 +248,5 @@ Example: | ||
| ```javascript | ||
| import { v4 as uuidv4 } from "uuid"; | ||
| import { v4 as uuidv4 } from 'uuid'; | ||
| uuidv4(); // ⇨ '7934256a-bc92-4b69-b240-f9e463881aea' | ||
| uuidv4(); // ⇨ 'b18794e8-5d0d-417c-b361-ba38e78411b4' | ||
| ``` | ||
@@ -257,3 +257,3 @@ | ||
| ```javascript | ||
| import { v4 as uuidv4 } from "uuid"; | ||
| import { v4 as uuidv4 } from 'uuid'; | ||
@@ -277,3 +277,3 @@ const v4options = { | ||
| 0x58, | ||
| 0x36, | ||
| 0x36 | ||
| ), | ||
@@ -288,9 +288,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` | | ||
@@ -304,9 +304,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' | ||
| ``` | ||
@@ -317,5 +317,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' | ||
| ``` | ||
@@ -330,5 +330,5 @@ | ||
| ```javascript | ||
| import { v6 as uuidv6 } from "uuid"; | ||
| import { v6 as uuidv6 } from 'uuid'; | ||
| uuidv6(); // ⇨ '1f131d04-d9dc-65a0-9516-5be66631ce97' | ||
| uuidv6(); // ⇨ '1efc7d35-7fd0-6000-841d-504d2167fc5b' | ||
| ``` | ||
@@ -339,3 +339,3 @@ | ||
| ```javascript | ||
| import { v6 as uuidv6 } from "uuid"; | ||
| import { v6 as uuidv6 } from 'uuid'; | ||
@@ -345,3 +345,3 @@ const options = { | ||
| clockseq: 0x1234, | ||
| msecs: new Date("2011-11-01").getTime(), | ||
| msecs: new Date('2011-11-01').getTime(), | ||
| nsecs: 5678, | ||
@@ -357,5 +357,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' | ||
| ``` | ||
@@ -367,12 +367,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` | | ||
@@ -382,5 +382,5 @@ Example: | ||
| ```javascript | ||
| import { v7 as uuidv7 } from "uuid"; | ||
| import { v7 as uuidv7 } from 'uuid'; | ||
| uuidv7(); // ⇨ '019d637c-c6fb-74e9-8b9d-2f1d459a4201' | ||
| uuidv7(); // ⇨ '01941f29-7c00-75f4-a310-744d2167fc5b' | ||
| ``` | ||
@@ -408,6 +408,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 | ||
| ``` | ||
@@ -418,4 +418,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'; | ||
@@ -426,4 +426,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'; | ||
@@ -447,6 +447,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 | ||
| ``` | ||
@@ -514,4 +514,4 @@ | ||
| ```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'; | ||
| ``` | ||
@@ -521,2 +521,2 @@ | ||
| Markdown generated from [README_js.md](README_js.md) by <a href="https://github.com/broofa/runmd"><image height="13" src="https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67" /></a> | ||
| Generated from [README_js.md](README_js.md) by [`runmd`](https://github.com/broofa/runmd) |
65672
-6.54%16
6.67%