Skip to content

Commit 60eb84a

Browse files
authored
Merge pull request #335 from ctavan/prepare-for-esm
Prepare for esm
2 parents eea07e8 + d125e45 commit 60eb84a

File tree

7 files changed

+190
-225
lines changed

7 files changed

+190
-225
lines changed

.eslintrc.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
"env": {
44
"browser": true,
55
"commonjs": true,
6-
"node": true,
7-
"mocha": true
6+
"mocha": true,
7+
"node": true
88
},
99
"extends": ["eslint:recommended"],
10+
"globals": {
11+
"msCrypto": true
12+
},
1013
"rules": {
1114
"array-bracket-spacing": ["warn", "never"],
1215
"arrow-body-style": ["warn", "as-needed"],

.travis.yml

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

README.md

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -129,23 +129,16 @@ Example: In-place generation of two binary IDs
129129
const arr = new Array();
130130
uuidv1(null, arr, 0); //
131131
// [
132-
// 44, 94, 164,
133-
// 192, 64, 103,
134-
// 17, 233, 146,
135-
// 52, 155, 29,
136-
// 235, 77, 59,
137-
// 125
132+
// 44, 94, 164, 192, 64, 103,
133+
// 17, 233, 146, 52, 155, 29,
134+
// 235, 77, 59, 125
138135
// ]
139136
uuidv1(null, arr, 16); //
140137
// [
141-
// 44, 94, 164, 192,
142-
// 64, 103, 17, 233,
143-
// 146, 52, 155, 29,
144-
// 235, 77, 59, 125,
145-
// 44, 94, 164, 193,
146-
// 64, 103, 17, 233,
147-
// 146, 52, 155, 29,
148-
// 235, 77, 59, 125
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
149142
// ]
150143

151144
```
@@ -217,23 +210,17 @@ Example: Generate two IDs in a single buffer
217210
const buffer = new Array();
218211
uuidv4(null, buffer, 0); //
219212
// [
220-
// 155, 29, 235,
221-
// 77, 59, 125,
222-
// 75, 173, 155,
223-
// 221, 43, 13,
224-
// 123, 61, 203,
213+
// 155, 29, 235, 77, 59,
214+
// 125, 75, 173, 155, 221,
215+
// 43, 13, 123, 61, 203,
225216
// 109
226217
// ]
227218
uuidv4(null, buffer, 16); //
228219
// [
229-
// 155, 29, 235, 77,
230-
// 59, 125, 75, 173,
231-
// 155, 221, 43, 13,
232-
// 123, 61, 203, 109,
233-
// 27, 157, 107, 205,
234-
// 187, 253, 75, 45,
235-
// 155, 93, 171, 141,
236-
// 251, 189, 75, 237
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
237224
// ]
238225

239226
```

lib/bytesToUuid.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ function bytesToUuid(buf, offset) {
1111
var i = offset || 0;
1212
var bth = byteToHex;
1313
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
14-
return ([bth[buf[i++]], bth[buf[i++]],
15-
bth[buf[i++]], bth[buf[i++]], '-',
16-
bth[buf[i++]], bth[buf[i++]], '-',
17-
bth[buf[i++]], bth[buf[i++]], '-',
18-
bth[buf[i++]], bth[buf[i++]], '-',
19-
bth[buf[i++]], bth[buf[i++]],
20-
bth[buf[i++]], bth[buf[i++]],
21-
bth[buf[i++]], bth[buf[i++]]]).join('');
14+
return ([
15+
bth[buf[i++]], bth[buf[i++]],
16+
bth[buf[i++]], bth[buf[i++]], '-',
17+
bth[buf[i++]], bth[buf[i++]], '-',
18+
bth[buf[i++]], bth[buf[i++]], '-',
19+
bth[buf[i++]], bth[buf[i++]], '-',
20+
bth[buf[i++]], bth[buf[i++]],
21+
bth[buf[i++]], bth[buf[i++]],
22+
bth[buf[i++]], bth[buf[i++]]
23+
]).join('');
2224
}
2325

2426
module.exports = bytesToUuid;

0 commit comments

Comments
 (0)