node-red-contrib-web-worldmap 2.23.4 → 2.24.2
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/CHANGELOG.md +4 -0
- package/README.md +15 -4
- package/node_modules/body-parser/HISTORY.md +15 -0
- package/node_modules/body-parser/README.md +25 -12
- package/node_modules/body-parser/node_modules/bytes/History.md +5 -0
- package/node_modules/body-parser/node_modules/bytes/Readme.md +42 -16
- package/node_modules/body-parser/node_modules/bytes/index.js +5 -1
- package/node_modules/body-parser/node_modules/bytes/package.json +20 -22
- package/node_modules/body-parser/package.json +34 -37
- package/node_modules/content-disposition/HISTORY.md +5 -0
- package/node_modules/content-disposition/README.md +3 -9
- package/node_modules/content-disposition/index.js +1 -1
- package/node_modules/content-disposition/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/content-disposition/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/content-disposition/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/content-disposition/node_modules/safe-buffer/index.js +65 -0
- package/node_modules/content-disposition/node_modules/safe-buffer/package.json +76 -0
- package/node_modules/content-disposition/package.json +27 -30
- package/node_modules/cookie/HISTORY.md +5 -0
- package/node_modules/cookie/README.md +4 -0
- package/node_modules/cookie/index.js +5 -1
- package/node_modules/cookie/package.json +22 -25
- package/node_modules/express/History.md +33 -0
- package/node_modules/express/Readme.md +8 -5
- package/node_modules/express/lib/application.js +1 -1
- package/node_modules/express/lib/request.js +1 -1
- package/node_modules/express/lib/response.js +16 -11
- package/node_modules/express/lib/router/index.js +6 -0
- package/node_modules/express/lib/utils.js +2 -6
- package/node_modules/express/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/express/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/express/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/express/node_modules/safe-buffer/index.js +65 -0
- package/node_modules/express/node_modules/safe-buffer/package.json +76 -0
- package/node_modules/express/package.json +37 -39
- package/node_modules/faye-websocket/CHANGELOG.md +5 -0
- package/node_modules/faye-websocket/LICENSE.md +1 -1
- package/node_modules/faye-websocket/README.md +13 -13
- package/node_modules/faye-websocket/lib/faye/websocket/api.js +10 -8
- package/node_modules/faye-websocket/lib/faye/websocket/client.js +4 -4
- package/node_modules/faye-websocket/lib/faye/websocket.js +1 -1
- package/node_modules/faye-websocket/package.json +16 -19
- package/node_modules/forwarded/HISTORY.md +5 -0
- package/node_modules/forwarded/README.md +3 -3
- package/node_modules/forwarded/index.js +15 -1
- package/node_modules/forwarded/package.json +27 -28
- package/node_modules/http-errors/HISTORY.md +16 -0
- package/node_modules/http-errors/README.md +12 -6
- package/node_modules/http-errors/index.js +35 -2
- package/node_modules/http-errors/package.json +32 -35
- package/node_modules/inherits/inherits.js +2 -0
- package/node_modules/inherits/inherits_browser.js +18 -14
- package/node_modules/inherits/package.json +17 -20
- package/node_modules/ipaddr.js/README.md +1 -1
- package/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +6 -9
- package/node_modules/ipaddr.js/package.json +17 -19
- package/node_modules/proxy-addr/HISTORY.md +11 -0
- package/node_modules/proxy-addr/README.md +3 -19
- package/node_modules/proxy-addr/index.js +1 -1
- package/node_modules/proxy-addr/package.json +30 -33
- package/node_modules/qs/.editorconfig +9 -0
- package/node_modules/qs/.eslintignore +2 -1
- package/node_modules/qs/.eslintrc +15 -1
- package/node_modules/qs/.github/FUNDING.yml +12 -0
- package/node_modules/qs/.nycrc +13 -0
- package/node_modules/qs/CHANGELOG.md +103 -0
- package/node_modules/qs/LICENSE.md +29 -0
- package/node_modules/qs/README.md +34 -0
- package/node_modules/qs/dist/qs.js +117 -67
- package/node_modules/qs/lib/formats.js +9 -4
- package/node_modules/qs/lib/parse.js +29 -14
- package/node_modules/qs/lib/stringify.js +55 -46
- package/node_modules/qs/lib/utils.js +23 -2
- package/node_modules/qs/package.json +42 -34
- package/node_modules/qs/test/parse.js +97 -1
- package/node_modules/qs/test/stringify.js +115 -1
- package/node_modules/qs/test/utils.js +1 -1
- package/node_modules/raw-body/HISTORY.md +14 -0
- package/node_modules/raw-body/README.md +3 -5
- package/node_modules/raw-body/node_modules/bytes/History.md +5 -0
- package/node_modules/raw-body/node_modules/bytes/Readme.md +42 -16
- package/node_modules/raw-body/node_modules/bytes/index.js +5 -1
- package/node_modules/raw-body/node_modules/bytes/package.json +20 -22
- package/node_modules/raw-body/package.json +32 -35
- package/node_modules/send/HISTORY.md +10 -0
- package/node_modules/send/README.md +4 -6
- package/node_modules/send/index.js +7 -3
- package/node_modules/send/node_modules/ms/index.js +3 -3
- package/node_modules/send/node_modules/ms/license.md +1 -1
- package/node_modules/send/node_modules/ms/package.json +21 -23
- package/node_modules/send/node_modules/ms/readme.md +1 -2
- package/node_modules/send/package.json +31 -34
- package/node_modules/serve-static/HISTORY.md +8 -0
- package/node_modules/serve-static/README.md +9 -11
- package/node_modules/serve-static/package.json +30 -33
- package/node_modules/setprototypeof/README.md +1 -1
- package/node_modules/setprototypeof/index.js +1 -1
- package/node_modules/setprototypeof/package.json +20 -21
- package/node_modules/sockjs/Changelog +12 -0
- package/node_modules/sockjs/lib/transport.js +1 -1
- package/node_modules/sockjs/package.json +16 -19
- package/node_modules/toidentifier/HISTORY.md +9 -0
- package/node_modules/toidentifier/README.md +3 -3
- package/node_modules/toidentifier/index.js +2 -0
- package/node_modules/toidentifier/package.json +30 -29
- package/node_modules/uuid/CHANGELOG.md +154 -44
- package/node_modules/uuid/CONTRIBUTING.md +18 -0
- package/node_modules/uuid/LICENSE.md +4 -16
- package/node_modules/uuid/README.md +384 -155
- package/node_modules/uuid/dist/bin/uuid +2 -0
- package/node_modules/uuid/dist/esm-browser/index.js +9 -0
- package/node_modules/uuid/{lib/md5-browser.js → dist/esm-browser/md5.js} +70 -71
- package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/node_modules/uuid/dist/esm-browser/parse.js +35 -0
- package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +19 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
- package/node_modules/uuid/dist/esm-browser/stringify.js +30 -0
- package/node_modules/uuid/{v1.js → dist/esm-browser/v1.js} +36 -50
- package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +64 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +24 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
- package/node_modules/uuid/dist/esm-browser/validate.js +7 -0
- package/node_modules/uuid/dist/esm-browser/version.js +11 -0
- package/node_modules/uuid/dist/esm-node/index.js +9 -0
- package/node_modules/uuid/dist/esm-node/md5.js +13 -0
- package/node_modules/uuid/dist/esm-node/nil.js +1 -0
- package/node_modules/uuid/dist/esm-node/parse.js +35 -0
- package/node_modules/uuid/dist/esm-node/regex.js +1 -0
- package/node_modules/uuid/dist/esm-node/rng.js +12 -0
- package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
- package/node_modules/uuid/dist/esm-node/stringify.js +29 -0
- package/node_modules/uuid/dist/esm-node/v1.js +95 -0
- package/node_modules/uuid/dist/esm-node/v3.js +4 -0
- package/node_modules/uuid/dist/esm-node/v35.js +64 -0
- package/node_modules/uuid/dist/esm-node/v4.js +24 -0
- package/node_modules/uuid/dist/esm-node/v5.js +4 -0
- package/node_modules/uuid/dist/esm-node/validate.js +7 -0
- package/node_modules/uuid/dist/esm-node/version.js +11 -0
- package/node_modules/uuid/dist/index.js +79 -0
- package/node_modules/uuid/dist/md5-browser.js +223 -0
- package/node_modules/uuid/dist/md5.js +23 -0
- package/node_modules/uuid/dist/nil.js +8 -0
- package/node_modules/uuid/dist/parse.js +45 -0
- package/node_modules/uuid/dist/regex.js +8 -0
- package/node_modules/uuid/dist/rng-browser.js +26 -0
- package/node_modules/uuid/dist/rng.js +24 -0
- package/node_modules/uuid/dist/sha1-browser.js +104 -0
- package/node_modules/uuid/dist/sha1.js +23 -0
- package/node_modules/uuid/dist/stringify.js +39 -0
- package/node_modules/uuid/dist/umd/uuid.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidNIL.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidParse.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidStringify.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidValidate.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidVersion.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
- package/node_modules/uuid/dist/uuid-bin.js +85 -0
- package/node_modules/uuid/dist/v1.js +107 -0
- package/node_modules/uuid/dist/v3.js +16 -0
- package/node_modules/uuid/dist/v35.js +78 -0
- package/node_modules/uuid/dist/v4.js +37 -0
- package/node_modules/uuid/dist/v5.js +16 -0
- package/node_modules/uuid/dist/validate.js +17 -0
- package/node_modules/uuid/dist/version.js +21 -0
- package/node_modules/uuid/package.json +118 -57
- package/node_modules/uuid/wrapper.mjs +10 -0
- package/node_modules/websocket-driver/node_modules/http-parser-js/package.json +4 -4
- package/package.json +3 -3
- package/worldmap/css/worldmap.css +6 -5
- package/worldmap/index.html +1 -0
- package/worldmap/leaflet/leaflet-arc.min.js +1 -0
- package/worldmap/worldmap.js +46 -27
- package/worldmap.html +1 -1
- package/worldmap.js +2 -2
- package/node_modules/qs/LICENSE +0 -28
- package/node_modules/qs/test/.eslintrc +0 -17
- package/node_modules/qs/test/index.js +0 -7
- package/node_modules/uuid/AUTHORS +0 -5
- package/node_modules/uuid/bin/uuid +0 -65
- package/node_modules/uuid/index.js +0 -8
- package/node_modules/uuid/lib/bytesToUuid.js +0 -26
- package/node_modules/uuid/lib/md5.js +0 -25
- package/node_modules/uuid/lib/rng-browser.js +0 -34
- package/node_modules/uuid/lib/rng.js +0 -8
- package/node_modules/uuid/lib/sha1-browser.js +0 -89
- package/node_modules/uuid/lib/sha1.js +0 -25
- package/node_modules/uuid/lib/v35.js +0 -57
- package/node_modules/uuid/v3.js +0 -4
- package/node_modules/uuid/v4.js +0 -29
- package/node_modules/uuid/v5.js +0 -3
|
@@ -2,275 +2,504 @@
|
|
|
2
2
|
-- This file is auto-generated from README_js.md. Changes should be made there.
|
|
3
3
|
-->
|
|
4
4
|
|
|
5
|
-
# uuid [](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [](https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs
|
|
10
|
+
- **Cross-platform** - Support for ...
|
|
11
|
+
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds)
|
|
12
|
+
- Node 8, 10, 12, 14
|
|
13
|
+
- Chrome, Safari, Firefox, Edge, IE 11 browsers
|
|
14
|
+
- Webpack and rollup.js module bundlers
|
|
15
|
+
- [React Native / Expo](#react-native--expo)
|
|
16
|
+
- **Secure** - Cryptographically-strong random values
|
|
17
|
+
- **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers
|
|
18
|
+
- **CLI** - Includes the [`uuid` command line](#command-line) utility
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
* Cross-platform
|
|
13
|
-
* Uses cryptographically-strong random number APIs (when available)
|
|
14
|
-
* Zero-dependency, small footprint (... but not [this small](https://gist.github.com/982883))
|
|
20
|
+
**Upgrading from `uuid@3.x`?** Your code is probably okay, but check out [Upgrading From `uuid@3.x`](#upgrading-from-uuid3x) for details.
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
supported after version 3.x of this module. Instead, use `require('uuid/[v1|v3|v4|v5]')` as shown in the examples below.]
|
|
22
|
+
## Quickstart
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
To create a random UUID...
|
|
25
|
+
|
|
26
|
+
**1. Install**
|
|
20
27
|
|
|
21
28
|
```shell
|
|
22
29
|
npm install uuid
|
|
23
30
|
```
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Version 1 (timestamp):
|
|
32
|
+
**2. Create a UUID** (ES6 module syntax)
|
|
28
33
|
|
|
29
34
|
```javascript
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
36
|
+
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
|
33
37
|
```
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
... or using CommonJS syntax:
|
|
36
40
|
|
|
37
41
|
```javascript
|
|
38
|
-
const
|
|
42
|
+
const { v4: uuidv4 } = require('uuid');
|
|
43
|
+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
44
|
+
```
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
|
|
46
|
+
For timestamp UUIDs, namespace UUIDs, and other options read on ...
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
|
|
48
|
+
## API Summary
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
| | | |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |
|
|
53
|
+
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |
|
|
54
|
+
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |
|
|
55
|
+
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | |
|
|
56
|
+
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | |
|
|
57
|
+
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | |
|
|
58
|
+
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | |
|
|
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` |
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
## API
|
|
63
|
+
|
|
64
|
+
### uuid.NIL
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
The nil UUID string (all zeros).
|
|
67
|
+
|
|
68
|
+
Example:
|
|
56
69
|
|
|
57
70
|
```javascript
|
|
58
|
-
|
|
59
|
-
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
71
|
+
import { NIL as NIL_UUID } from 'uuid';
|
|
60
72
|
|
|
73
|
+
NIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000'
|
|
61
74
|
```
|
|
62
75
|
|
|
63
|
-
|
|
76
|
+
### uuid.parse(str)
|
|
64
77
|
|
|
65
|
-
|
|
66
|
-
const uuidv5 = require('uuid/v5');
|
|
78
|
+
Convert UUID string to array of bytes
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
| | |
|
|
81
|
+
| --------- | ---------------------------------------- |
|
|
82
|
+
| `str` | A valid UUID `String` |
|
|
83
|
+
| _returns_ | `Uint8Array[16]` |
|
|
84
|
+
| _throws_ | `TypeError` if `str` is not a valid UUID |
|
|
70
85
|
|
|
71
|
-
|
|
72
|
-
uuidv5('http://example.com/hello', uuidv5.URL); // ⇨ '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'
|
|
86
|
+
Note: Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below.
|
|
73
87
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
79
|
-
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
|
88
|
+
Example:
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
import { parse as uuidParse } from 'uuid';
|
|
80
92
|
|
|
93
|
+
// Parse a UUID
|
|
94
|
+
const bytes = uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b');
|
|
95
|
+
|
|
96
|
+
// Convert to hex strings to show byte order (for documentation purposes)
|
|
97
|
+
[...bytes].map((v) => v.toString(16).padStart(2, '0')); // ⇨
|
|
98
|
+
// [
|
|
99
|
+
// '6e', 'c0', 'bd', '7f',
|
|
100
|
+
// '11', 'c0', '43', 'da',
|
|
101
|
+
// '97', '5e', '2a', '8a',
|
|
102
|
+
// 'd9', 'eb', 'ae', '0b'
|
|
103
|
+
// ]
|
|
81
104
|
```
|
|
82
105
|
|
|
83
|
-
|
|
106
|
+
### uuid.stringify(arr[, offset])
|
|
84
107
|
|
|
85
|
-
|
|
108
|
+
Convert array of bytes to UUID string
|
|
86
109
|
|
|
87
|
-
|
|
88
|
-
|
|
110
|
+
| | |
|
|
111
|
+
| -------------- | ---------------------------------------------------------------------------- |
|
|
112
|
+
| `arr` | `Array`-like collection of 16 values (starting from `offset`) between 0-255. |
|
|
113
|
+
| [`offset` = 0] | `Number` Starting index in the Array |
|
|
114
|
+
| _returns_ | `String` |
|
|
115
|
+
| _throws_ | `TypeError` if a valid UUID string cannot be generated |
|
|
89
116
|
|
|
90
|
-
|
|
91
|
-
uuidv1();
|
|
92
|
-
uuidv1(options);
|
|
93
|
-
uuidv1(options, buffer, offset);
|
|
94
|
-
```
|
|
117
|
+
Note: Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below.
|
|
95
118
|
|
|
96
|
-
|
|
119
|
+
Example:
|
|
97
120
|
|
|
98
|
-
|
|
121
|
+
```javascript
|
|
122
|
+
import { stringify as uuidStringify } from 'uuid';
|
|
123
|
+
|
|
124
|
+
const uuidBytes = [
|
|
125
|
+
0x6e,
|
|
126
|
+
0xc0,
|
|
127
|
+
0xbd,
|
|
128
|
+
0x7f,
|
|
129
|
+
0x11,
|
|
130
|
+
0xc0,
|
|
131
|
+
0x43,
|
|
132
|
+
0xda,
|
|
133
|
+
0x97,
|
|
134
|
+
0x5e,
|
|
135
|
+
0x2a,
|
|
136
|
+
0x8a,
|
|
137
|
+
0xd9,
|
|
138
|
+
0xeb,
|
|
139
|
+
0xae,
|
|
140
|
+
0x0b,
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
|
|
144
|
+
```
|
|
99
145
|
|
|
100
|
-
|
|
101
|
-
* `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
|
|
102
|
-
* `msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used.
|
|
103
|
-
* `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.
|
|
146
|
+
### uuid.v1([options[, buffer[, offset]]])
|
|
104
147
|
|
|
105
|
-
|
|
106
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
|
148
|
+
Create an RFC version 1 (timestamp) UUID
|
|
107
149
|
|
|
108
|
-
|
|
150
|
+
| | |
|
|
151
|
+
| --- | --- |
|
|
152
|
+
| [`options`] | `Object` with one or more of the following properties: |
|
|
153
|
+
| [`options.node` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) |
|
|
154
|
+
| [`options.clockseq`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff |
|
|
155
|
+
| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
|
156
|
+
| [`options.nsecs`] | RFC "timestamp" field (`Number` of nanseconds to add to `msecs`, should be 0-10,000) |
|
|
157
|
+
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
|
158
|
+
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
159
|
+
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
|
160
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
161
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
162
|
+
| _throws_ | `Error` if more than 10M UUIDs/sec are requested |
|
|
109
163
|
|
|
110
164
|
Note: The default [node id](https://tools.ietf.org/html/rfc4122#section-4.1.6) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.
|
|
111
165
|
|
|
112
|
-
|
|
166
|
+
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.
|
|
167
|
+
|
|
168
|
+
Example:
|
|
113
169
|
|
|
114
170
|
```javascript
|
|
171
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
172
|
+
|
|
173
|
+
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d'
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Example using `options`:
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
180
|
+
|
|
115
181
|
const v1options = {
|
|
116
182
|
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
|
117
183
|
clockseq: 0x1234,
|
|
118
184
|
msecs: new Date('2011-11-01').getTime(),
|
|
119
|
-
nsecs: 5678
|
|
185
|
+
nsecs: 5678,
|
|
120
186
|
};
|
|
121
187
|
uuidv1(v1options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
|
122
|
-
|
|
123
188
|
```
|
|
124
189
|
|
|
125
|
-
|
|
190
|
+
### uuid.v3(name, namespace[, buffer[, offset]])
|
|
191
|
+
|
|
192
|
+
Create an RFC version 3 (namespace w/ MD5) UUID
|
|
193
|
+
|
|
194
|
+
API is identical to `v5()`, but uses "v3" instead.
|
|
195
|
+
|
|
196
|
+
⚠️ Note: Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
|
197
|
+
|
|
198
|
+
### uuid.v4([options[, buffer[, offset]]])
|
|
199
|
+
|
|
200
|
+
Create an RFC version 4 (random) UUID
|
|
201
|
+
|
|
202
|
+
| | |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| [`options`] | `Object` with one or more of the following properties: |
|
|
205
|
+
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
|
206
|
+
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
207
|
+
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
|
208
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
209
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
210
|
+
|
|
211
|
+
Example:
|
|
126
212
|
|
|
127
213
|
```javascript
|
|
128
|
-
|
|
129
|
-
const arr = new Array();
|
|
130
|
-
uuidv1(null, arr, 0); // ⇨
|
|
131
|
-
// [
|
|
132
|
-
// 44, 94, 164, 192, 64, 103,
|
|
133
|
-
// 17, 233, 146, 52, 155, 29,
|
|
134
|
-
// 235, 77, 59, 125
|
|
135
|
-
// ]
|
|
136
|
-
uuidv1(null, arr, 16); // ⇨
|
|
137
|
-
// [
|
|
138
|
-
// 44, 94, 164, 192, 64, 103, 17, 233,
|
|
139
|
-
// 146, 52, 155, 29, 235, 77, 59, 125,
|
|
140
|
-
// 44, 94, 164, 193, 64, 103, 17, 233,
|
|
141
|
-
// 146, 52, 155, 29, 235, 77, 59, 125
|
|
142
|
-
// ]
|
|
214
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
143
215
|
|
|
216
|
+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
144
217
|
```
|
|
145
218
|
|
|
146
|
-
|
|
219
|
+
Example using predefined `random` values:
|
|
147
220
|
|
|
148
221
|
```javascript
|
|
149
|
-
|
|
222
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
150
223
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
224
|
+
const v4options = {
|
|
225
|
+
random: [
|
|
226
|
+
0x10,
|
|
227
|
+
0x91,
|
|
228
|
+
0x56,
|
|
229
|
+
0xbe,
|
|
230
|
+
0xc4,
|
|
231
|
+
0xfb,
|
|
232
|
+
0xc1,
|
|
233
|
+
0xea,
|
|
234
|
+
0x71,
|
|
235
|
+
0xb4,
|
|
236
|
+
0xef,
|
|
237
|
+
0xe1,
|
|
238
|
+
0x67,
|
|
239
|
+
0x1c,
|
|
240
|
+
0x58,
|
|
241
|
+
0x36,
|
|
242
|
+
],
|
|
243
|
+
};
|
|
244
|
+
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
155
245
|
```
|
|
156
246
|
|
|
157
|
-
|
|
247
|
+
### uuid.v5(name, namespace[, buffer[, offset]])
|
|
158
248
|
|
|
159
|
-
|
|
160
|
-
* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
161
|
-
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
162
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
|
|
249
|
+
Create an RFC version 5 (namespace w/ SHA-1) UUID
|
|
163
250
|
|
|
164
|
-
|
|
251
|
+
| | |
|
|
252
|
+
| --- | --- |
|
|
253
|
+
| `name` | `String \| Array` |
|
|
254
|
+
| `namespace` | `String \| Array[16]` Namespace UUID |
|
|
255
|
+
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
|
256
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
257
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
165
258
|
|
|
166
|
-
|
|
259
|
+
Note: The RFC `DNS` and `URL` namespaces are available as `v5.DNS` and `v5.URL`.
|
|
260
|
+
|
|
261
|
+
Example with custom namespace:
|
|
167
262
|
|
|
168
263
|
```javascript
|
|
169
|
-
|
|
264
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
170
265
|
|
|
266
|
+
// Define a custom namespace. Readers, create your own using something like
|
|
267
|
+
// https://www.uuidgenerator.net/
|
|
268
|
+
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
269
|
+
|
|
270
|
+
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
|
171
271
|
```
|
|
172
272
|
|
|
173
|
-
|
|
273
|
+
Example with RFC `URL` namespace:
|
|
174
274
|
|
|
175
275
|
```javascript
|
|
176
|
-
|
|
276
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
177
277
|
|
|
178
|
-
//
|
|
179
|
-
uuidv4();
|
|
180
|
-
uuidv4(options);
|
|
181
|
-
uuidv4(options, buffer, offset);
|
|
278
|
+
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
|
|
182
279
|
```
|
|
183
280
|
|
|
184
|
-
|
|
281
|
+
### uuid.validate(str)
|
|
185
282
|
|
|
186
|
-
|
|
187
|
-
* `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values
|
|
188
|
-
* `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255)
|
|
189
|
-
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
190
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
|
283
|
+
Test a string to see if it is a valid UUID
|
|
191
284
|
|
|
192
|
-
|
|
285
|
+
| | |
|
|
286
|
+
| --------- | --------------------------------------------------- |
|
|
287
|
+
| `str` | `String` to validate |
|
|
288
|
+
| _returns_ | `true` if string is a valid UUID, `false` otherwise |
|
|
193
289
|
|
|
194
|
-
Example:
|
|
290
|
+
Example:
|
|
195
291
|
|
|
196
292
|
```javascript
|
|
197
|
-
|
|
198
|
-
random: [
|
|
199
|
-
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
|
|
200
|
-
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
|
|
201
|
-
]
|
|
202
|
-
};
|
|
203
|
-
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
293
|
+
import { validate as uuidValidate } from 'uuid';
|
|
204
294
|
|
|
295
|
+
uuidValidate('not a UUID'); // ⇨ false
|
|
296
|
+
uuidValidate('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ true
|
|
205
297
|
```
|
|
206
298
|
|
|
207
|
-
|
|
299
|
+
Using `validate` and `version` together it is possible to do per-version validation, e.g. validate for only v4 UUIds.
|
|
208
300
|
|
|
209
301
|
```javascript
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
// [
|
|
213
|
-
// 155, 29, 235, 77, 59,
|
|
214
|
-
// 125, 75, 173, 155, 221,
|
|
215
|
-
// 43, 13, 123, 61, 203,
|
|
216
|
-
// 109
|
|
217
|
-
// ]
|
|
218
|
-
uuidv4(null, buffer, 16); // ⇨
|
|
219
|
-
// [
|
|
220
|
-
// 155, 29, 235, 77, 59, 125, 75, 173,
|
|
221
|
-
// 155, 221, 43, 13, 123, 61, 203, 109,
|
|
222
|
-
// 27, 157, 107, 205, 187, 253, 75, 45,
|
|
223
|
-
// 155, 93, 171, 141, 251, 189, 75, 237
|
|
224
|
-
// ]
|
|
302
|
+
import { version as uuidVersion } from 'uuid';
|
|
303
|
+
import { validate as uuidValidate } from 'uuid';
|
|
225
304
|
|
|
226
|
-
|
|
305
|
+
function uuidValidateV4(uuid) {
|
|
306
|
+
return uuidValidate(uuid) && uuidVersion(uuid) === 4;
|
|
307
|
+
}
|
|
227
308
|
|
|
228
|
-
|
|
309
|
+
const v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210';
|
|
310
|
+
const v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836';
|
|
229
311
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
// Incantations
|
|
234
|
-
uuidv5(name, namespace);
|
|
235
|
-
uuidv5(name, namespace, buffer);
|
|
236
|
-
uuidv5(name, namespace, buffer, offset);
|
|
312
|
+
uuidValidateV4(v4Uuid); // ⇨ true
|
|
313
|
+
uuidValidateV4(v1Uuid); // ⇨ false
|
|
237
314
|
```
|
|
238
315
|
|
|
239
|
-
|
|
316
|
+
### uuid.version(str)
|
|
240
317
|
|
|
241
|
-
|
|
242
|
-
* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
243
|
-
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
244
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
|
|
318
|
+
Detect RFC version of a UUID
|
|
245
319
|
|
|
246
|
-
|
|
320
|
+
| | |
|
|
321
|
+
| --------- | ---------------------------------------- |
|
|
322
|
+
| `str` | A valid UUID `String` |
|
|
323
|
+
| _returns_ | `Number` The RFC version of the UUID |
|
|
324
|
+
| _throws_ | `TypeError` if `str` is not a valid UUID |
|
|
247
325
|
|
|
248
326
|
Example:
|
|
249
327
|
|
|
250
328
|
```javascript
|
|
251
|
-
|
|
329
|
+
import { version as uuidVersion } from 'uuid';
|
|
252
330
|
|
|
331
|
+
uuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1
|
|
332
|
+
uuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4
|
|
253
333
|
```
|
|
254
334
|
|
|
255
335
|
## Command Line
|
|
256
336
|
|
|
257
|
-
UUIDs can be generated from the command line
|
|
337
|
+
UUIDs can be generated from the command line using `uuid`.
|
|
258
338
|
|
|
259
339
|
```shell
|
|
260
340
|
$ uuid
|
|
261
341
|
ddeb27fb-d9a0-4624-be4d-4615062daed4
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
The default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:
|
|
262
345
|
|
|
263
|
-
|
|
264
|
-
|
|
346
|
+
```shell
|
|
347
|
+
$ uuid --help
|
|
348
|
+
|
|
349
|
+
Usage:
|
|
350
|
+
uuid
|
|
351
|
+
uuid v1
|
|
352
|
+
uuid v3 <name> <namespace uuid>
|
|
353
|
+
uuid v4
|
|
354
|
+
uuid v5 <name> <namespace uuid>
|
|
355
|
+
uuid --help
|
|
356
|
+
|
|
357
|
+
Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs
|
|
358
|
+
defined by RFC4122
|
|
265
359
|
```
|
|
266
360
|
|
|
267
|
-
|
|
361
|
+
## ECMAScript Modules
|
|
362
|
+
|
|
363
|
+
This library comes with [ECMAScript Modules](https://www.ecma-international.org/ecma-262/6.0/#sec-modules) (ESM) support for Node.js versions that support it ([example](./examples/node-esmodules/)) as well as bundlers like [rollup.js](https://rollupjs.org/guide/en/#tree-shaking) ([example](./examples/browser-rollup/)) and [webpack](https://webpack.js.org/guides/tree-shaking/) ([example](./examples/browser-webpack/)) (targeting both, Node.js and browser environments).
|
|
364
|
+
|
|
365
|
+
```javascript
|
|
366
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
367
|
+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
368
|
+
```
|
|
268
369
|
|
|
269
|
-
|
|
370
|
+
To run the examples you must first create a dist build of this library in the module root:
|
|
270
371
|
|
|
271
372
|
```shell
|
|
272
|
-
npm
|
|
373
|
+
npm run build
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## CDN Builds
|
|
377
|
+
|
|
378
|
+
### ECMAScript Modules
|
|
379
|
+
|
|
380
|
+
To load this module directly into modern browsers that [support loading ECMAScript Modules](https://caniuse.com/#feat=es6-module) you can make use of [jspm](https://jspm.org/):
|
|
381
|
+
|
|
382
|
+
```html
|
|
383
|
+
<script type="module">
|
|
384
|
+
import { v4 as uuidv4 } from 'https://jspm.dev/uuid';
|
|
385
|
+
console.log(uuidv4()); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
386
|
+
</script>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### UMD
|
|
390
|
+
|
|
391
|
+
To load this module directly into older browsers you can use the [UMD (Universal Module Definition)](https://github.com/umdjs/umd) builds from any of the following CDNs:
|
|
392
|
+
|
|
393
|
+
**Using [UNPKG](https://unpkg.com/uuid@latest/dist/umd/)**:
|
|
394
|
+
|
|
395
|
+
```html
|
|
396
|
+
<script src="https://unpkg.com/uuid@latest/dist/umd/uuidv4.min.js"></script>
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Using [jsDelivr](https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/)**:
|
|
400
|
+
|
|
401
|
+
```html
|
|
402
|
+
<script src="https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/uuidv4.min.js"></script>
|
|
273
403
|
```
|
|
274
404
|
|
|
405
|
+
**Using [cdnjs](https://cdnjs.com/libraries/uuid)**:
|
|
406
|
+
|
|
407
|
+
```html
|
|
408
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuidv4.min.js"></script>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
These CDNs all provide the same [`uuidv4()`](#uuidv4options-buffer-offset) method:
|
|
412
|
+
|
|
413
|
+
```html
|
|
414
|
+
<script>
|
|
415
|
+
uuidv4(); // ⇨ '55af1e37-0734-46d8-b070-a1e42e4fc392'
|
|
416
|
+
</script>
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Methods for the other algorithms ([`uuidv1()`](#uuidv1options-buffer-offset), [`uuidv3()`](#uuidv3name-namespace-buffer-offset) and [`uuidv5()`](#uuidv5name-namespace-buffer-offset)) are available from the files `uuidv1.min.js`, `uuidv3.min.js` and `uuidv5.min.js` respectively.
|
|
420
|
+
|
|
421
|
+
## "getRandomValues() not supported"
|
|
422
|
+
|
|
423
|
+
This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill:
|
|
424
|
+
|
|
425
|
+
### React Native / Expo
|
|
426
|
+
|
|
427
|
+
1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)
|
|
428
|
+
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:
|
|
429
|
+
|
|
430
|
+
```javascript
|
|
431
|
+
import 'react-native-get-random-values';
|
|
432
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Note: If you are using Expo, you must be using at least `react-native-get-random-values@1.5.0` and `expo@39.0.0`.
|
|
436
|
+
|
|
437
|
+
### Web Workers / Service Workers (Edge <= 18)
|
|
438
|
+
|
|
439
|
+
[In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please).
|
|
440
|
+
|
|
441
|
+
## Upgrading From `uuid@7.x`
|
|
442
|
+
|
|
443
|
+
### Only Named Exports Supported When Using with Node.js ESM
|
|
444
|
+
|
|
445
|
+
`uuid@7.x` did not come with native ECMAScript Module (ESM) support for Node.js. Importing it in Node.js ESM consequently imported the CommonJS source with a default export. This library now comes with true Node.js ESM support and only provides named exports.
|
|
446
|
+
|
|
447
|
+
Instead of doing:
|
|
448
|
+
|
|
449
|
+
```javascript
|
|
450
|
+
import uuid from 'uuid';
|
|
451
|
+
uuid.v4();
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
you will now have to use the named exports:
|
|
455
|
+
|
|
456
|
+
```javascript
|
|
457
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
458
|
+
uuidv4();
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Deep Requires No Longer Supported
|
|
462
|
+
|
|
463
|
+
Deep requires like `require('uuid/v4')` [which have been deprecated in `uuid@7.x`](#deep-requires-now-deprecated) are no longer supported.
|
|
464
|
+
|
|
465
|
+
## Upgrading From `uuid@3.x`
|
|
466
|
+
|
|
467
|
+
"_Wait... what happened to `uuid@4.x` - `uuid@6.x`?!?_"
|
|
468
|
+
|
|
469
|
+
In order to avoid confusion with RFC [version 4](#uuidv4options-buffer-offset) and [version 5](#uuidv5name-namespace-buffer-offset) UUIDs, and a possible [version 6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been skipped.
|
|
470
|
+
|
|
471
|
+
### Deep Requires Now Deprecated
|
|
472
|
+
|
|
473
|
+
`uuid@3.x` encouraged the use of deep requires to minimize the bundle size of browser builds:
|
|
474
|
+
|
|
475
|
+
```javascript
|
|
476
|
+
const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED!
|
|
477
|
+
uuidv4();
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
As of `uuid@7.x` this library now provides ECMAScript modules builds, which allow packagers like Webpack and Rollup to do "tree-shaking" to remove dead code. Instead, use the `import` syntax:
|
|
481
|
+
|
|
482
|
+
```javascript
|
|
483
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
484
|
+
uuidv4();
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
... or for CommonJS:
|
|
488
|
+
|
|
489
|
+
```javascript
|
|
490
|
+
const { v4: uuidv4 } = require('uuid');
|
|
491
|
+
uuidv4();
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Default Export Removed
|
|
495
|
+
|
|
496
|
+
`uuid@3.x` was exporting the Version 4 UUID method as a default export:
|
|
497
|
+
|
|
498
|
+
```javascript
|
|
499
|
+
const uuid = require('uuid'); // <== REMOVED!
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
This usage pattern was already discouraged in `uuid@3.x` and has been removed in `uuid@7.x`.
|
|
503
|
+
|
|
275
504
|
----
|
|
276
505
|
Markdown generated from [README_js.md](README_js.md) by [](https://github.com/broofa/runmd)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as v1 } from './v1.js';
|
|
2
|
+
export { default as v3 } from './v3.js';
|
|
3
|
+
export { default as v4 } from './v4.js';
|
|
4
|
+
export { default as v5 } from './v5.js';
|
|
5
|
+
export { default as NIL } from './nil.js';
|
|
6
|
+
export { default as version } from './version.js';
|
|
7
|
+
export { default as validate } from './validate.js';
|
|
8
|
+
export { default as stringify } from './stringify.js';
|
|
9
|
+
export { default as parse } from './parse.js';
|