fix(core): update
This commit is contained in:
14
ts/index.ts
14
ts/index.ts
@@ -1,10 +1,10 @@
|
||||
import * as plugins from './smartunique.plugins';
|
||||
import * as plugins from './smartunique.plugins.js';
|
||||
|
||||
/**
|
||||
* returns short strings that are unique to very high degree od certainty
|
||||
*/
|
||||
export const shortId = (): string => {
|
||||
return plugins.shortid.generate();
|
||||
export const shortId = (sizeArg?: number): string => {
|
||||
return plugins.nanoid.nanoid(sizeArg);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -18,4 +18,10 @@ export const uuid5 = (customStringArg: string, namespaceArg = plugins.uuid.v5.DN
|
||||
return plugins.uuid.v5(customStringArg, namespaceArg);
|
||||
};
|
||||
|
||||
export const uni = plugins.isounique.uni;
|
||||
export const uni = (prefix: string = 'uni') => {
|
||||
return `${prefix}_${`xxxxxxxxxxxxxxxxxxxxxxxx`.replace(/[xy]/g, (c) => {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
})}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user