Skip to content

Commit

Permalink
feat(uuid): expose uuidv1, uuidv3, uuidv4, uuidv5 shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
lykmapipo committed May 18, 2020
1 parent 625702c commit ade596d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
21 changes: 17 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
"randomcolor": ">=0.5.4",
"statuses": ">=2.0.0",
"string-template": ">=1.0.0",
"striptags": ">=3.1.1"
"striptags": ">=3.1.1",
"uuid": ">=8.0.0"
},
"engines": {
"node": ">=8.11.1",
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ import parseMilliSeconds from 'parse-ms';

export { STATUS_CODES };

export { v1 as uuidv1, v3 as uuidv3, v4 as uuidv4, v5 as uuidv5 } from 'uuid';

export { isNode, isBrowser, isWebWorker } from 'browser-or-node';

/**
Expand Down
11 changes: 11 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { _ } from 'lodash';
import { expect } from '@lykmapipo/test-helpers';
import {
STATUS_CODES,
uuidv1,
uuidv3,
uuidv4,
uuidv5,
isNode,
isBrowser,
isWebWorker,
Expand Down Expand Up @@ -54,6 +58,13 @@ describe('common', () => {
expect(STATUS_CODES).to.exist.and.be.an('object');
});

it('should expose uuid shortcuts', () => {
expect(uuidv1()).to.be.exist;
expect(uuidv3('hello.example.com', uuidv3.DNS)).to.be.exist;
expect(uuidv4()).to.be.exist;
expect(uuidv5('hello.example.com', uuidv5.DNS)).to.be.exist;
});

it('should check for node runtime', () => {
expect(isNode).to.be.true;
});
Expand Down

0 comments on commit ade596d

Please sign in to comment.