code-random
v1.1.0
Published
Generate a random code
Downloads
7
Readme
code-random
Get a random text code for your needs.
Installation
npm
npm install code-random
yarn
yarn add code-random
Usage/Examples
import getRandomCode from 'code-random'
const lettersCode = getRandomCode(6, { letters: true }); // arovup
const absoluteRandomCode = getRandomCode(16,
{ letters: true, digits: true, symbols: true },
true,
); // W$+mj4^/@ri%Z48v
/**
* type PatternConfig = {
* letters?: boolean;
* digits?: boolean;
* symbols?: boolean;
* }
// getRandomCode(length: number, config: PatternConfig, uppercase: boolean)