r4ndm-str
v1.2.0
Published
Generate random strings
Downloads
132
Maintainers
Readme
R4ndm-Str
Description
Library to provide a way to generate random strings using or not capital letters, small letters, numbers and symbols. It is also possible to remove the similar characters
- Capital letters:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
- Small letters:
abcdefghijklmnopqrstuvwxyz
- Numbers:
0123456789
- Symbols:
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
- Similar characters:
0126GIOSZgiosz`'
How to use
Install
- Install with npm
npm i r4ndm-str
- or with yarn
yarn add r4ndm-str
Example
- See the code bellow for generate a password
const { RandomStringGenerator } = require('r4ndm-str')
const randomString = new RandomStringGenerator()
const size = 10
const password = randomString.generate(size)
console.info(password)
//printed console: QF:Qr\W(;M
Settings
It is possible to pass some parameters to indicate what kind of characters will be used to generate a random string. Let's see!
useCapitalLetters
: Indicates if use capital lettersuseSmallLetters
: Indicates if use small lettersuseNumbers
: Indicates if use numbersuseSymbols
: Indicates if use SymbolsremoveSimilarCharacters
: To avoid issues with similar characters, it's possible to remove them.
Examples
- See the code bellow for generate a password
const { RandomStringGenerator } = require('r4ndm-str')
const randomString = new RandomStringGenerator({
useSmallLetters: false,
useSymbols: false,
removeSimilarCharacters: true
})
const size = 10
const password = randomString.generate(size)
console.info(password)
//printed console: 5H94BFQXE3