fix(core): update
This commit is contained in:
parent
0f802e223e
commit
b6d5db4605
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartunique',
|
||||
version: '3.0.7',
|
||||
version: '3.0.8',
|
||||
description: 'make things unique'
|
||||
}
|
||||
|
@ -18,16 +18,16 @@ export const uuid5 = (customStringArg: string, namespaceArg = plugins.uuid.v5.DN
|
||||
return plugins.uuid.v5(customStringArg, namespaceArg);
|
||||
};
|
||||
|
||||
export const uni = (prefix: string = 'uni') => {
|
||||
return `${prefix}_${`xxxxxxxxxxxxxxxxxxxxxxxx`.replace(/[xy]/g, (c) => {
|
||||
export const uni = (prefix: string = 'uni', lengthArg = 24) => {
|
||||
return `${prefix}_${'x'.repeat(lengthArg).replace(/[xy]/g, (c) => {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
})}`;
|
||||
};
|
||||
|
||||
export const uniSimple = (prefix: string = 'uni') => {
|
||||
return `${prefix}${`xxxxxxxxxxxxxxxxxxxxxxxx`.replace(/[xy]/g, (c) => {
|
||||
export const uniSimple = (prefix: string = 'uni', lengthArg = 8) => {
|
||||
return `${prefix}${'x'.repeat(lengthArg).replace(/[xy]/g, (c) => {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
|
Loading…
Reference in New Issue
Block a user