Password generator using JS for NodeJS
Install js-password-gen with npm
//Production dependencie
npm install js-password-gen
//Developer dependencie
npm install js-password-gen -D
-
NodeJS syntax
//@ts-check const generatePassword = require("js-password-gen"); const password = generatePassword(length, options); /* length: Number, options: { chars: boolean, upperCase?: boolean, numbers?: boolean, symbols?: boolean } */
-
Example:
//@ts-check const generatePassword = require("js-password-gen"); const password = generatePassword(16, {chars: true, symbols: true, numbers: true, upperCase:true}) console.log(`password:`, password) //password: #YP]%#x]u3K:/Z0;
- Type
number
- Default value:
8
- Max value:
64
Prop | Type | Description | Required |
---|---|---|---|
chars | boolean |
Include characters in your password. | ✅ |
upperCase | boolean |
Include upper case characters in your password. | |
numbers | boolean |
Include numbers in your password. | |
symbols | boolean |
Include symbols in your password. |