uuid 14.0.0 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -99
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -32,32 +32,32 @@ npm install uuid
|
|
|
32
32
|
**2. Create a UUID**
|
|
33
33
|
|
|
34
34
|
```javascript
|
|
35
|
-
import { v4 as uuidv4 } from
|
|
35
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
36
36
|
|
|
37
|
-
uuidv4(); // ⇨ '
|
|
37
|
+
uuidv4(); // ⇨ 'b18794e8-5d0d-417c-b361-ba38e78411b4'
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
For timestamp UUIDs, namespace UUIDs, and other options read on ...
|
|
41
41
|
|
|
42
42
|
## API Summary
|
|
43
43
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
| [`uuid.NIL`](#uuidnil)
|
|
47
|
-
| [`uuid.MAX`](#uuidmax)
|
|
48
|
-
| [`uuid.parse()`](#uuidparsestr)
|
|
49
|
-
| [`uuid.stringify()`](#uuidstringifyarr-offset)
|
|
50
|
-
| [`uuid.v1()`](#uuidv1options-buffer-offset)
|
|
51
|
-
| [`uuid.v1ToV6()`](#uuidv1tov6uuid)
|
|
52
|
-
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID
|
|
53
|
-
| [`uuid.v4()`](#uuidv4options-buffer-offset)
|
|
54
|
-
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID
|
|
55
|
-
| [`uuid.v6()`](#uuidv6options-buffer-offset)
|
|
56
|
-
| [`uuid.v6ToV1()`](#uuidv6tov1uuid)
|
|
57
|
-
| [`uuid.v7()`](#uuidv7options-buffer-offset)
|
|
58
|
-
| ~~[`uuid.v8()`](#uuidv8)~~
|
|
59
|
-
| [`uuid.validate()`](#uuidvalidatestr)
|
|
60
|
-
| [`uuid.version()`](#uuidversionstr)
|
|
44
|
+
| | | |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |
|
|
47
|
+
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |
|
|
48
|
+
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |
|
|
49
|
+
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |
|
|
50
|
+
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | |
|
|
51
|
+
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |
|
|
52
|
+
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | |
|
|
53
|
+
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | |
|
|
54
|
+
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | |
|
|
55
|
+
| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |
|
|
56
|
+
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |
|
|
57
|
+
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |
|
|
58
|
+
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" | |
|
|
59
|
+
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |
|
|
60
|
+
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |
|
|
61
61
|
|
|
62
62
|
## API
|
|
63
63
|
|
|
@@ -68,7 +68,7 @@ The nil UUID string (all zeros).
|
|
|
68
68
|
Example:
|
|
69
69
|
|
|
70
70
|
```javascript
|
|
71
|
-
import { NIL as NIL_UUID } from
|
|
71
|
+
import { NIL as NIL_UUID } from 'uuid';
|
|
72
72
|
|
|
73
73
|
NIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000'
|
|
74
74
|
```
|
|
@@ -80,7 +80,7 @@ The max UUID string (all ones).
|
|
|
80
80
|
Example:
|
|
81
81
|
|
|
82
82
|
```javascript
|
|
83
|
-
import { MAX as MAX_UUID } from
|
|
83
|
+
import { MAX as MAX_UUID } from 'uuid';
|
|
84
84
|
|
|
85
85
|
MAX_UUID; // ⇨ 'ffffffff-ffff-ffff-ffff-ffffffffffff'
|
|
86
86
|
```
|
|
@@ -102,10 +102,10 @@ Convert UUID string to array of bytes
|
|
|
102
102
|
Example:
|
|
103
103
|
|
|
104
104
|
```javascript
|
|
105
|
-
import { parse as uuidParse } from
|
|
105
|
+
import { parse as uuidParse } from 'uuid';
|
|
106
106
|
|
|
107
107
|
// Parse a UUID
|
|
108
|
-
uuidParse(
|
|
108
|
+
uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨
|
|
109
109
|
// Uint8Array(16) [
|
|
110
110
|
// 110, 192, 189, 127, 17,
|
|
111
111
|
// 192, 67, 218, 151, 94,
|
|
@@ -132,7 +132,7 @@ Convert array of bytes to UUID string
|
|
|
132
132
|
Example:
|
|
133
133
|
|
|
134
134
|
```javascript
|
|
135
|
-
import { stringify as uuidStringify } from
|
|
135
|
+
import { stringify as uuidStringify } from 'uuid';
|
|
136
136
|
|
|
137
137
|
const uuidBytes = Uint8Array.of(
|
|
138
138
|
0x6e,
|
|
@@ -150,7 +150,7 @@ const uuidBytes = Uint8Array.of(
|
|
|
150
150
|
0xd9,
|
|
151
151
|
0xeb,
|
|
152
152
|
0xae,
|
|
153
|
-
0x0b
|
|
153
|
+
0x0b
|
|
154
154
|
);
|
|
155
155
|
|
|
156
156
|
uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
|
|
@@ -160,37 +160,37 @@ uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
|
|
|
160
160
|
|
|
161
161
|
Create an RFC version 1 (timestamp) UUID
|
|
162
162
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
| [`options`]
|
|
166
|
-
| [`options.node = (random)` ]
|
|
167
|
-
| [`options.clockseq = (random)`]
|
|
168
|
-
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch)
|
|
169
|
-
| [`options.nsecs = 0`]
|
|
170
|
-
| [`options.random = (random)`]
|
|
171
|
-
| [`options.rng`]
|
|
172
|
-
| [`buffer`]
|
|
173
|
-
| [`offset` = 0]
|
|
174
|
-
| _returns_
|
|
175
|
-
| _throws_
|
|
163
|
+
| | |
|
|
164
|
+
| --- | --- |
|
|
165
|
+
| [`options`] | `Object` with one or more of the following properties: |
|
|
166
|
+
| [`options.node = (random)` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) |
|
|
167
|
+
| [`options.clockseq = (random)`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff |
|
|
168
|
+
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
|
169
|
+
| [`options.nsecs = 0`] | RFC "timestamp" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) |
|
|
170
|
+
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
|
|
171
|
+
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
172
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
173
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
174
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
175
|
+
| _throws_ | `Error` if more than 10M UUIDs/sec are requested |
|
|
176
176
|
|
|
177
177
|
Example:
|
|
178
178
|
|
|
179
179
|
```javascript
|
|
180
|
-
import { v1 as uuidv1 } from
|
|
180
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
181
181
|
|
|
182
|
-
uuidv1(); // ⇨ '
|
|
182
|
+
uuidv1(); // ⇨ '57fd0000-c7d3-11ef-841d-514d2167fc5b'
|
|
183
183
|
```
|
|
184
184
|
|
|
185
185
|
Example using `options`:
|
|
186
186
|
|
|
187
187
|
```javascript
|
|
188
|
-
import { v1 as uuidv1 } from
|
|
188
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
189
189
|
|
|
190
190
|
const options = {
|
|
191
191
|
node: Uint8Array.of(0x01, 0x23, 0x45, 0x67, 0x89, 0xab),
|
|
192
192
|
clockseq: 0x1234,
|
|
193
|
-
msecs: new Date(
|
|
193
|
+
msecs: new Date('2011-11-01').getTime(),
|
|
194
194
|
nsecs: 5678,
|
|
195
195
|
};
|
|
196
196
|
uuidv1(options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
|
@@ -201,9 +201,9 @@ uuidv1(options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
|
|
201
201
|
Convert a UUID from version 1 to version 6
|
|
202
202
|
|
|
203
203
|
```javascript
|
|
204
|
-
import { v1ToV6 } from
|
|
204
|
+
import { v1ToV6 } from 'uuid';
|
|
205
205
|
|
|
206
|
-
v1ToV6(
|
|
206
|
+
v1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
### uuid.v3(name, namespace[, buffer[, offset]])
|
|
@@ -220,27 +220,27 @@ API is identical to `v5()`, but uses "v3" instead.
|
|
|
220
220
|
|
|
221
221
|
Create an RFC version 4 (random) UUID
|
|
222
222
|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
| [`options`]
|
|
226
|
-
| [`options.random`] | `Array` of 16 random bytes (0-255)
|
|
227
|
-
| [`options.rng`]
|
|
228
|
-
| [`buffer`]
|
|
229
|
-
| [`offset` = 0]
|
|
230
|
-
| _returns_
|
|
223
|
+
| | |
|
|
224
|
+
| --- | --- |
|
|
225
|
+
| [`options`] | `Object` with one or more of the following properties: |
|
|
226
|
+
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
|
227
|
+
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
228
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
229
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
230
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
231
231
|
|
|
232
232
|
Example:
|
|
233
233
|
|
|
234
234
|
```javascript
|
|
235
|
-
import { v4 as uuidv4 } from
|
|
235
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
236
236
|
|
|
237
|
-
uuidv4(); // ⇨ '
|
|
237
|
+
uuidv4(); // ⇨ 'b18794e8-5d0d-417c-b361-ba38e78411b4'
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
Example using predefined `random` values:
|
|
241
241
|
|
|
242
242
|
```javascript
|
|
243
|
-
import { v4 as uuidv4 } from
|
|
243
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
244
244
|
|
|
245
245
|
const v4options = {
|
|
246
246
|
random: Uint8Array.of(
|
|
@@ -259,7 +259,7 @@ const v4options = {
|
|
|
259
259
|
0x67,
|
|
260
260
|
0x1c,
|
|
261
261
|
0x58,
|
|
262
|
-
0x36
|
|
262
|
+
0x36
|
|
263
263
|
),
|
|
264
264
|
};
|
|
265
265
|
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
@@ -269,13 +269,13 @@ uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
|
269
269
|
|
|
270
270
|
Create an RFC version 5 (namespace w/ SHA-1) UUID
|
|
271
271
|
|
|
272
|
-
|
|
|
273
|
-
|
|
|
274
|
-
| `name`
|
|
275
|
-
| `namespace`
|
|
276
|
-
| [`buffer`]
|
|
277
|
-
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer`
|
|
278
|
-
| _returns_
|
|
272
|
+
| | |
|
|
273
|
+
| --- | --- |
|
|
274
|
+
| `name` | `String \| Array` |
|
|
275
|
+
| `namespace` | `String \| Array[16]` Namespace UUID |
|
|
276
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
277
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
278
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
279
279
|
|
|
280
280
|
<!-- prettier-ignore -->
|
|
281
281
|
> [!NOTE]
|
|
@@ -284,21 +284,21 @@ Create an RFC version 5 (namespace w/ SHA-1) UUID
|
|
|
284
284
|
Example with custom namespace:
|
|
285
285
|
|
|
286
286
|
```javascript
|
|
287
|
-
import { v5 as uuidv5 } from
|
|
287
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
288
288
|
|
|
289
289
|
// Define a custom namespace. Readers, create your own using something like
|
|
290
290
|
// https://www.uuidgenerator.net/
|
|
291
|
-
const MY_NAMESPACE =
|
|
291
|
+
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
292
292
|
|
|
293
|
-
uuidv5(
|
|
293
|
+
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
|
294
294
|
```
|
|
295
295
|
|
|
296
296
|
Example with RFC `URL` namespace:
|
|
297
297
|
|
|
298
298
|
```javascript
|
|
299
|
-
import { v5 as uuidv5 } from
|
|
299
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
300
300
|
|
|
301
|
-
uuidv5(
|
|
301
|
+
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
|
|
302
302
|
```
|
|
303
303
|
|
|
304
304
|
### uuid.v6([options[, buffer[, offset]]])
|
|
@@ -308,20 +308,20 @@ Create an RFC version 6 (timestamp, reordered) UUID
|
|
|
308
308
|
This method takes the same arguments as uuid.v1().
|
|
309
309
|
|
|
310
310
|
```javascript
|
|
311
|
-
import { v6 as uuidv6 } from
|
|
311
|
+
import { v6 as uuidv6 } from 'uuid';
|
|
312
312
|
|
|
313
|
-
uuidv6(); // ⇨ '
|
|
313
|
+
uuidv6(); // ⇨ '1efc7d35-7fd0-6000-841d-504d2167fc5b'
|
|
314
314
|
```
|
|
315
315
|
|
|
316
316
|
Example using `options`:
|
|
317
317
|
|
|
318
318
|
```javascript
|
|
319
|
-
import { v6 as uuidv6 } from
|
|
319
|
+
import { v6 as uuidv6 } from 'uuid';
|
|
320
320
|
|
|
321
321
|
const options = {
|
|
322
322
|
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
|
323
323
|
clockseq: 0x1234,
|
|
324
|
-
msecs: new Date(
|
|
324
|
+
msecs: new Date('2011-11-01').getTime(),
|
|
325
325
|
nsecs: 5678,
|
|
326
326
|
};
|
|
327
327
|
uuidv6(options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab'
|
|
@@ -332,32 +332,32 @@ uuidv6(options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab'
|
|
|
332
332
|
Convert a UUID from version 6 to version 1
|
|
333
333
|
|
|
334
334
|
```javascript
|
|
335
|
-
import { v6ToV1 } from
|
|
335
|
+
import { v6ToV1 } from 'uuid';
|
|
336
336
|
|
|
337
|
-
v6ToV1(
|
|
337
|
+
v6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'
|
|
338
338
|
```
|
|
339
339
|
|
|
340
340
|
### uuid.v7([options[, buffer[, offset]]])
|
|
341
341
|
|
|
342
342
|
Create an RFC version 7 (random) UUID
|
|
343
343
|
|
|
344
|
-
|
|
|
345
|
-
|
|
|
346
|
-
| [`options`]
|
|
347
|
-
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch)
|
|
348
|
-
| [`options.random = (random)`]
|
|
349
|
-
| [`options.rng`]
|
|
350
|
-
| [`options.seq = (random)`]
|
|
351
|
-
| [`buffer`]
|
|
352
|
-
| [`offset` = 0]
|
|
353
|
-
| _returns_
|
|
344
|
+
| | |
|
|
345
|
+
| --- | --- |
|
|
346
|
+
| [`options`] | `Object` with one or more of the following properties: |
|
|
347
|
+
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
|
348
|
+
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
|
|
349
|
+
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
350
|
+
| [`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. |
|
|
351
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
352
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
353
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
354
354
|
|
|
355
355
|
Example:
|
|
356
356
|
|
|
357
357
|
```javascript
|
|
358
|
-
import { v7 as uuidv7 } from
|
|
358
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
359
359
|
|
|
360
|
-
uuidv7(); // ⇨ '
|
|
360
|
+
uuidv7(); // ⇨ '01941f29-7c00-75f4-a310-744d2167fc5b'
|
|
361
361
|
```
|
|
362
362
|
|
|
363
363
|
### ~~uuid.v8()~~
|
|
@@ -380,24 +380,24 @@ Test a string to see if it is a valid UUID
|
|
|
380
380
|
Example:
|
|
381
381
|
|
|
382
382
|
```javascript
|
|
383
|
-
import { validate as uuidValidate } from
|
|
383
|
+
import { validate as uuidValidate } from 'uuid';
|
|
384
384
|
|
|
385
|
-
uuidValidate(
|
|
386
|
-
uuidValidate(
|
|
385
|
+
uuidValidate('not a UUID'); // ⇨ false
|
|
386
|
+
uuidValidate('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ true
|
|
387
387
|
```
|
|
388
388
|
|
|
389
389
|
Using `validate` and `version` together it is possible to do per-version validation, e.g. validate for only v4 UUIds.
|
|
390
390
|
|
|
391
391
|
```javascript
|
|
392
|
-
import { version as uuidVersion } from
|
|
393
|
-
import { validate as uuidValidate } from
|
|
392
|
+
import { version as uuidVersion } from 'uuid';
|
|
393
|
+
import { validate as uuidValidate } from 'uuid';
|
|
394
394
|
|
|
395
395
|
function uuidValidateV4(uuid) {
|
|
396
396
|
return uuidValidate(uuid) && uuidVersion(uuid) === 4;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
const v1Uuid =
|
|
400
|
-
const v4Uuid =
|
|
399
|
+
const v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210';
|
|
400
|
+
const v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836';
|
|
401
401
|
|
|
402
402
|
uuidValidateV4(v4Uuid); // ⇨ true
|
|
403
403
|
uuidValidateV4(v1Uuid); // ⇨ false
|
|
@@ -416,10 +416,10 @@ Detect RFC version of a UUID
|
|
|
416
416
|
Example:
|
|
417
417
|
|
|
418
418
|
```javascript
|
|
419
|
-
import { version as uuidVersion } from
|
|
419
|
+
import { version as uuidVersion } from 'uuid';
|
|
420
420
|
|
|
421
|
-
uuidVersion(
|
|
422
|
-
uuidVersion(
|
|
421
|
+
uuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1
|
|
422
|
+
uuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4
|
|
423
423
|
```
|
|
424
424
|
|
|
425
425
|
<!-- prettier-ignore -->
|
|
@@ -482,10 +482,10 @@ This error occurs in environments where the standard [`crypto.getRandomValues()`
|
|
|
482
482
|
1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point:
|
|
483
483
|
|
|
484
484
|
```javascript
|
|
485
|
-
import
|
|
486
|
-
import { v4 as uuidv4 } from
|
|
485
|
+
import 'react-native-get-random-values';
|
|
486
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
487
487
|
```
|
|
488
488
|
|
|
489
489
|
---
|
|
490
490
|
|
|
491
|
-
|
|
491
|
+
Generated from [README_js.md](README_js.md) by [`runmd`](https://github.com/broofa/runmd)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uuid",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "RFC9562 UUIDs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"funding": [
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"node":
|
|
29
|
+
"node": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist-node/index.js"
|
|
32
|
+
},
|
|
30
33
|
"default": "./dist/index.js"
|
|
31
34
|
},
|
|
32
35
|
"./package.json": "./package.json"
|
|
@@ -43,13 +46,14 @@
|
|
|
43
46
|
"bundlewatch": "0.4.1",
|
|
44
47
|
"commander": "14.0.3",
|
|
45
48
|
"globals": "17.4.0",
|
|
46
|
-
"husky": "9.1.7",
|
|
47
49
|
"jest": "30.3.0",
|
|
50
|
+
"lefthook": "1.11.13",
|
|
48
51
|
"lint-staged": "16.4.0",
|
|
49
52
|
"neostandard": "0.13.0",
|
|
50
53
|
"npm-run-all2": "8.0.4",
|
|
54
|
+
"prettier": "3.8.3",
|
|
51
55
|
"release-please": "17.3.0",
|
|
52
|
-
"runmd": "1.
|
|
56
|
+
"runmd": "2.1.1",
|
|
53
57
|
"standard-version": "9.5.0",
|
|
54
58
|
"typescript": "5.4.3"
|
|
55
59
|
},
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
"build": "./scripts/build.sh",
|
|
66
70
|
"build:watch": "tsc --watch -p tsconfig.json",
|
|
67
71
|
"bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json",
|
|
68
|
-
"docs:diff": "npm run docs && git diff
|
|
72
|
+
"docs:diff": "npm run docs && git diff README.md",
|
|
69
73
|
"docs": "npm run build && npx runmd --output=README.md README_js.md",
|
|
70
74
|
"biome:check": "biome check .",
|
|
71
75
|
"biome:fix": "biome check --write .",
|
|
@@ -77,7 +81,7 @@
|
|
|
77
81
|
"lint": "npm run biome:check",
|
|
78
82
|
"md": "runmd --watch --output=README.md README_js.md",
|
|
79
83
|
"prepack": "npm run build -- --no-pack",
|
|
80
|
-
"prepare": "
|
|
84
|
+
"prepare": "lefthook install",
|
|
81
85
|
"prepublishOnly": "npm run build",
|
|
82
86
|
"pretest:benchmark": "npm run build",
|
|
83
87
|
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all --parallel examples:browser:**",
|