fix(core): update
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal 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'
|
||||
}
|
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);
|
||||
})}`;
|
||||
};
|
||||
|
@ -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 };
|
||||
|
Reference in New Issue
Block a user