smartstring/ts/smartstring.create.ts
2022-03-18 22:50:24 +01:00

30 lines
710 B
TypeScript

import * as plugins from './smartstring.plugins.js';
/**
* creates a random string
*
* ```ts
* createRandomString('AAAA')
* //=> 'AGHR'
* ```
*
* @param patternArg the pattern argument to use, Aa0!* are viable pattern descritors
* @param lengthArg the length of the random string
* @param optionsArg options
*/
export const createRandomString = (
patternArg: string,
lengthArg?: number,
optionsArg?: any
): string => {
return plugins.randomatic(patternArg, lengthArg, optionsArg);
};
/**
* creates a crytic string in the speicifed length
* @param lengthArg the length of the crypto string
*/
export const createCryptoRandomString = (): string => {
return plugins.isounique.uni();
};