Skip to content

Commit

Permalink
feat: add NIL_UUID export, fixes #475
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Jul 17, 2020
1 parent 82ef52b commit 7e2a384
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/browser-webpack/example-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ testpage(function (addTest, done) {

addTest('Same with default export');

addTest('uuid.NIL_UUID', uuid.NIL_UUID);
addTest('uuid.v1()', uuid.v1());
addTest('uuid.v4()', uuid.v4());
addTest('uuid.v3() DNS', uuid.v3('hello.example.com', uuid.v3.DNS));
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export { default as v1 } from './v1.js';
export { default as v3 } from './v3.js';
export { default as v4 } from './v4.js';
export { default as v5 } from './v5.js';
export { default as NIL_UUID } from './nil_uuid.js';
export { default as REGEX } from './regex.js';
export { default as version } from './version.js';
export { default as validate } from './validate.js';
Expand Down
1 change: 1 addition & 0 deletions src/nil_uuid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default '00000000-0000-0000-0000-000000000000';
3 changes: 2 additions & 1 deletion test/unit/validate.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import assert from 'assert';
import validate from '../../src/validate.js';
import NIL_UUID from '../../src/nil_uuid.js';

describe('validate', () => {
test('validate uuid', () => {
assert.strictEqual(validate('00000000-0000-0000-0000-000000000000'), true);
assert.strictEqual(validate(NIL_UUID), true);

assert.strictEqual(validate('d9428888-122b-11e1-b85c-61cd3cbb3210'), true);

Expand Down
3 changes: 2 additions & 1 deletion test/unit/version.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import assert from 'assert';
import version from '../../src/version.js';
import NIL_UUID from '../../src/nil_uuid.js';

describe('version', () => {
test('check uuid version', () => {
assert.strictEqual(version('00000000-0000-0000-0000-000000000000'), 0);
assert.strictEqual(version(NIL_UUID), 0);

assert.strictEqual(version('d9428888-122b-11e1-b85c-61cd3cbb3210'), 1);

Expand Down

0 comments on commit 7e2a384

Please sign in to comment.