You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -104,7 +136,7 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
104
136
105
137
*`node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.
106
138
*`clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
107
-
*`msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used.
139
+
*`msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used.
108
140
*`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.
109
141
110
142
*`buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
@@ -132,8 +164,43 @@ Example: In-place generation of two binary IDs
Copy file name to clipboardexpand all lines: README_js.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -23,14 +23,14 @@ Then generate your uuid version of choice ...
23
23
24
24
Version 1 (timestamp):
25
25
26
-
```javascript --context
26
+
```javascript --run uuid
27
27
constuuidv1=require('uuid/v1');
28
28
uuidv1(); // RESULT
29
29
```
30
30
31
31
Version 3 (namespace):
32
32
33
-
```javascript --context
33
+
```javascript --run v3
34
34
constuuidv3=require('uuid/v3');
35
35
36
36
// ... using predefined DNS namespace (for domain names)
@@ -49,14 +49,14 @@ uuidv3('Hello, World!', MY_NAMESPACE); // RESULT
49
49
50
50
Version 4 (random):
51
51
52
-
```javascript --context
52
+
```javascript --run uuid
53
53
constuuidv4=require('uuid/v4');
54
54
uuidv4(); // RESULT
55
55
```
56
56
57
57
Version 5 (namespace):
58
58
59
-
```javascript --context
59
+
```javascript --run v5
60
60
constuuidv5=require('uuid/v5');
61
61
62
62
// ... using predefined DNS namespace (for domain names)
@@ -132,7 +132,7 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
132
132
133
133
*`node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.
134
134
*`clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
135
-
*`msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used.
135
+
*`msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used.
136
136
*`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.
137
137
138
138
*`buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
@@ -144,7 +144,7 @@ Note: The <node> id is generated guaranteed to stay constant for the lifetime of
144
144
145
145
Example: Generate string UUID with fully-specified options
146
146
147
-
```javascript --context
147
+
```javascript --run uuid
148
148
constv1options= {
149
149
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
150
150
clockseq:0x1234,
@@ -156,7 +156,7 @@ uuidv1(v1options); // RESULT
156
156
157
157
Example: In-place generation of two binary IDs
158
158
159
-
```javascript --context
159
+
```javascript --run uuid
160
160
// Generate two ids in an array
161
161
constarr=newArray();
162
162
uuidv1(null, arr, 0); // RESULT
@@ -220,7 +220,7 @@ Returns `buffer`, if specified, otherwise the string form of the UUID
220
220
221
221
Example: Generate string UUID with predefined `random` values
0 commit comments