Skip to content

Commit 19c22dc

Browse files
authored
June '19 update (#306)
* chore: add "~" range on dependencies * chore: upgrade to latest module versions * chore: prevent doc churn due to non-deterministic Date and rng methods * chore: remove node v4 as supported platform * chore: fixup README formatting * chore: more audit warning fixes * chore: fix #310
1 parent 36a5f18 commit 19c22dc

File tree

6 files changed

+1782
-1224
lines changed

6 files changed

+1782
-1224
lines changed

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tag-version-prefix="v"
2+
save-prefix="~"

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: node_js
22
node_js:
3-
- "4"
43
- "6"
54
- "8"
65
- "10"

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Version 1 (timestamp):
2828

2929
```javascript
3030
const uuidv1 = require('uuid/v1');
31-
uuidv1(); // ⇨ '3b99e3e0-7598-11e8-90be-95472fb3ecbd'
31+
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d'
3232

3333
```
3434

@@ -56,7 +56,7 @@ Version 4 (random):
5656

5757
```javascript
5858
const uuidv4 = require('uuid/v4');
59-
uuidv4(); // ⇨ '3a017fc5-4f50-4db9-b0ce-4547ba0a1bfd'
59+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
6060

6161
```
6262

@@ -147,7 +147,7 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
147147

148148
Returns `buffer`, if specified, otherwise the string form of the UUID
149149

150-
Note: The <node> id is generated guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)
150+
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.
151151

152152
Example: Generate string UUID with fully-specified options
153153

@@ -167,8 +167,8 @@ Example: In-place generation of two binary IDs
167167
```javascript
168168
// Generate two ids in an array
169169
const arr = new Array();
170-
uuidv1(null, arr, 0); // ⇨ [ 59, 155, 106, 128, 117, 152, 17, 232, 146, 52, 149, 71, 47, 179, 236, 189 ]
171-
uuidv1(null, arr, 16); // ⇨ [ 59, 155, 106, 128, 117, 152, 17, 232, 146, 52, 149, 71, 47, 179, 236, 189, 59, 155, 145, 144, 117, 152, 17, 232, 146, 52, 149, 71, 47, 179, 236, 189 ]
170+
uuidv1(null, arr, 0); // ⇨ [ 44, 94, 164, 192, 64, 103, 17, 233, 146, 52, 155, 29, 235, 77, 59, 125 ]
171+
uuidv1(null, arr, 16); // ⇨ [ 44, 94, 164, 192, 64, 103, 17, 233, 146, 52, 155, 29, 235, 77, 59, 125, 44, 94, 164, 193, 64, 103, 17, 233, 146, 52, 155, 29, 235, 77, 59, 125 ]
172172

173173
```
174174

@@ -237,8 +237,8 @@ Example: Generate two IDs in a single buffer
237237

238238
```javascript
239239
const buffer = new Array();
240-
uuidv4(null, buffer, 0); // ⇨ [ 202, 18, 44, 182, 222, 65, 71, 82, 164, 80, 208, 169, 173, 93, 252, 13 ]
241-
uuidv4(null, buffer, 16); // ⇨ [ 202, 18, 44, 182, 222, 65, 71, 82, 164, 80, 208, 169, 173, 93, 252, 13, 243, 221, 205, 191, 130, 146, 75, 199, 146, 71, 96, 195, 45, 156, 124, 9 ]
240+
uuidv4(null, buffer, 0); // ⇨ [ 155, 29, 235, 77, 59, 125, 75, 173, 155, 221, 43, 13, 123, 61, 203, 109 ]
241+
uuidv4(null, buffer, 16); // ⇨ [ 155, 29, 235, 77, 59, 125, 75, 173, 155, 221, 43, 13, 123, 61, 203, 109, 27, 157, 107, 205, 187, 253, 75, 45, 155, 93, 171, 141, 251, 189, 75, 237 ]
242242

243243
```
244244

README_js.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
```javascript --hide
2-
runmd.onRequire = path => path.replace(/^uuid/, './');
2+
runmd.onRequire = path => {
3+
if (path == 'rng') return fun
4+
return path.replace(/^uuid/, './');
5+
}
6+
7+
// Shim Date and crypto so generated ids are consistent across doc revisions
8+
runmd.Date.prototype.getTime = () => 1551914748172;
9+
10+
let seed = 0xDEFACED;
11+
require('crypto').randomBytes = function() {
12+
const a = [];
13+
for (let i = 0; i < 16; i++) a.push((seed = seed * 0x41a7 & 0x7fffffff) & 0xff);
14+
return a;
15+
}
316
```
417

518
# uuid [![Build Status](https://secure.travis-ci.org/kelektiv/node-uuid.svg?branch=master)](http://travis-ci.org/kelektiv/node-uuid) #
@@ -143,7 +156,7 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
143156

144157
Returns `buffer`, if specified, otherwise the string form of the UUID
145158

146-
Note: The <node> id is generated guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)
159+
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.
147160

148161
Example: Generate string UUID with fully-specified options
149162

0 commit comments

Comments
 (0)