Skip to content

Commit

Permalink
fix: pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Jun 5, 2024
1 parent 5df758e commit 08d9303
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
10 changes: 5 additions & 5 deletions README_js.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ Example using `options`:
```javascript --run
import { v1 as uuidv1 } from 'uuid';

const v1options = {
const options = {
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
clockseq: 0x1234,
msecs: new Date('2011-11-01').getTime(),
nsecs: 5678,
};
uuidv1(v1options); // RESULT
uuidv1(options); // RESULT
```

### uuid.v1ToV6(uuid)
Expand Down Expand Up @@ -306,7 +306,7 @@ uuidv5('https://www.w3.org/', uuidv5.URL); // RESULT

Create an RFC version 6 (timestamp, reordered) UUID

This method takes the same args as uuid.v1().
This method takes the same arguments as uuid.v1().

```javascript --run
import { v6 as uuidv6 } from 'uuid';
Expand All @@ -319,13 +319,13 @@ Example using `options`:
```javascript --run
import { v6 as uuidv6 } from 'uuid';

const v1options = {
const options = {
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
clockseq: 0x1234,
msecs: new Date('2011-11-01').getTime(),
nsecs: 5678,
};
uuidv6(v1options); // RESULT
uuidv6(options); // RESULT
```

### uuid.v6ToV1(uuid)
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ module.exports = [
},
parser: babelParser,
},
},
{
rules: {
'no-var': ['error'],
curly: ['error', 'all'],
},
},
{
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
"@babel/preset-env": "7.24.6",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@wdio/browserstack-service": "7.16.10",
"@wdio/cli": "7.16.10",
"@wdio/jasmine-framework": "7.16.6",
"@wdio/local-runner": "7.16.10",
"@wdio/spec-reporter": "7.16.9",
"@wdio/static-server-service": "7.16.6",
"bundlewatch": "0.3.3",
"eslint": "9.4.0",
"eslint-plugin-prettier": "5.1.3",
Expand Down Expand Up @@ -132,13 +138,5 @@
"postchangelog": "prettier --write CHANGELOG.md"
}
},
"dependencies": {
"@wdio/browserstack-service": "7.16.10",
"@wdio/cli": "7.16.10",
"@wdio/jasmine-framework": "7.16.6",
"@wdio/local-runner": "7.16.10",
"@wdio/spec-reporter": "7.16.9",
"@wdio/static-server-service": "7.16.6"
},
"packageManager": "npm@10.8.1+sha256.b8807aebb9656758e2872fa6e7c564b506aa2faa9297439a478d471d2fe32483"
}
8 changes: 6 additions & 2 deletions src/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ function v1(options, buf, offset) {

// v1 only: Use cached `node` and `clockseq` values
if (!options._v6) {
if (!node) node = _nodeId;
if (clockseq == null) clockseq = _clockseq;
if (!node) {
node = _nodeId;
}
if (clockseq == null) {
clockseq = _clockseq;
}
}

// Handle cases where we need entropy. We do this lazily to minimize issues
Expand Down
4 changes: 3 additions & 1 deletion test/browser/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ describe('BrowserStack Local Testing', () => {
const resultEl = await element.$('dd');
const result = await resultEl.getText();

if (!expectations[title]) throw new Error(`Unexpected title: ${title}`);
if (!expectations[title]) {
throw new Error(`Unexpected title: ${title}`);
}

expectations[title](result);
titles.push(title);
Expand Down
8 changes: 6 additions & 2 deletions test/unit/validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ describe('validate', () => {

// NIL UUIDs that have a bit set (incorrectly) should not validate
for (let charIndex = 0; charIndex < 36; charIndex++) {
if (charIndex === 14) continue; // version field
if (charIndex === 14) {
continue;
} // version field

for (let bit = 0; bit < 4; bit++) {
const chars = NIL.split('');
if (chars[charIndex] === '-') continue;
if (chars[charIndex] === '-') {
continue;
}

chars[charIndex] = (1 << bit).toString(16);
assert.strictEqual(validate(chars.join('')), false);
Expand Down

0 comments on commit 08d9303

Please sign in to comment.