Skip to content

Commit

Permalink
break: use named v4 export
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Oct 28, 2020
1 parent e77255c commit 3e77ae9
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const contenders = {
'String.replace(Math.random)': replace_random,
'String.replace(crypto)': replace_crypto,
'uuid/v4': require('uuid').v4,
'@lukeed/uuid': require('../dist'),
'@lukeed/uuid/secure': require('../secure'),
'@lukeed/uuid': require('../dist').v4,
'@lukeed/uuid/secure': require('../secure').v4,
};

console.log('Validation: ');
Expand Down
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default function (): string;
export function v4(): string;
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var IDX=256, HEX=[], BUFFER;
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);

export default function () {
export function v4() {
var i=0, num, out='';

if (!BUFFER || ((IDX + 16) > 256)) {
Expand Down
2 changes: 1 addition & 1 deletion src/secure.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default function (): string;
export function v4(): string;
2 changes: 1 addition & 1 deletion src/secure.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for (; IDX < 256; IDX++) {
HEX[IDX] = (IDX + 256).toString(16).substring(1);
}

export default function () {
export function v4() {
if (!BUFFER || ((IDX + 16) > SIZE)) {
BUFFER = random(SIZE);
IDX = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from 'uvu';
import isUUID from 'is-uuid';
import * as assert from 'uvu/assert';
import uuid from '../src';
import { v4 as uuid } from '../src';

test('exports', () => {
assert.type(uuid, 'function', 'exports function');
Expand Down
2 changes: 1 addition & 1 deletion test/secure.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from 'uvu';
import isUUID from 'is-uuid';
import * as assert from 'uvu/assert';
import uuid from '../src/secure';
import { v4 as uuid } from '../src/secure';

test('exports', () => {
assert.type(uuid, 'function', 'exports function');
Expand Down

0 comments on commit 3e77ae9

Please sign in to comment.