fix(core): update

This commit is contained in:
2020-03-05 20:39:44 +00:00
parent 45d8752a71
commit 20a16aef32
12 changed files with 1572 additions and 422 deletions

View File

@@ -3,17 +3,25 @@ import * as plugins from './smartunique.plugins';
/**
* returns short strings that are unique to very high degree od certainty
*/
export let shortId = (): string => {
export const shortId = (): string => {
return plugins.shortid.generate();
};
/**
* returns strings that are unique to a very high degree of certainty
*/
export let uuid4 = (): string => {
return plugins.uuidv4();
export const uuid4 = (): string => {
return plugins.uuid.v4();
};
export let uuid5 = (customStringArg: string, namespaceArg = plugins.uuidv5.DNS): string => {
return plugins.uuidv5(customStringArg, namespaceArg);
export const uuid5 = (customStringArg: string, namespaceArg = plugins.uuid.v5.DNS): string => {
return plugins.uuid.v5(customStringArg, namespaceArg);
};
export const uni = () => {
return 'unixxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = (Math.random() * 16) | 0;
const v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
};

View File

@@ -1,5 +1,4 @@
import * as shortid from 'shortid';
import * as uuidv4 from 'uuid/v4';
import * as uuidv5 from 'uuid/v5';
import shortid from 'shortid';
import * as uuid from 'uuid';
export { shortid, uuidv4, uuidv5 };
export { shortid, uuid };