yakras_generation_password

1.0.0 • Public • Published

Generating secure random passwords

The generatePassword function allows you to customize the password length and select the character types to be used.

generatePassword(length, useUpperCase, useLowerCase, useNumbers, useSpecialCharacters)

The basic function for generating a password:

  • length: The length of the generated password (default is 12).
  • useUpperCase: Whether to include uppercase letters (default is true).
  • useLowerCase: Whether to include lowercase letters (default is true).
  • useNumbers: Whether to include numbers (defaults to true).
  • useSpecialCharacters: Whether to include special characters (default is true).

getRandomElement(array)

This function takes an array as an argument and returns a random element from it.

Example of use:

  • console.log(generatePassword(12, true, true, true, true, true)); // Mixed password
  • console.log(generatePassword(16, true, true, false, false)); // Password without numbers and special characters
  • console.log(generatePassword(10, false, false, true, true, true, true)); // Password with numbers and special characters only

Readme

Keywords

none

Package Sidebar

Install

npm i yakras_generation_password

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

2.6 kB

Total Files

3

Last publish

Collaborators

  • ya_kras