fix(core): update

This commit is contained in:
2023-08-15 11:32:46 +02:00
parent 039a4ded96
commit 00e4d35c55
16 changed files with 6055 additions and 4995 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartunique',
version: '3.0.6',
description: 'make things unique'
}

View File

@ -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);
})}`;
};

View File

@ -1,11 +1,4 @@
// pushrocks scope
import * as isounique from '@pushrocks/isounique';
export {
isounique
};
import shortid from 'shortid';
import * as nanoid from 'nanoid';
import * as uuid from 'uuid';
export { shortid, uuid };
export { nanoid, uuid };