js-generate-password is usable for every javascript and typescript based project like react, vue, node, etc. it used to generate passwords that may contain alphabets, number and symbols. The options parameter enables the user to enable or disable the characters that are used to generate random password.

Overview

js-generate-password

js-generate-password is usable for every javascript and typescript based project like react, vue, node, etc. it used to generate passwords that may contain alphabets, number and symbols. The options parameter enables the user to enable or disable the characters that are used to generate random password.

The characters that may be choosen from are

  • Lowercase Characters
  • Uppercase Characters
  • Numbers
  • Symbols

The user may also specify the minimum number of character for each type.

Installation

npm install js-generate-password or yarn add js-generate-password

Usage

For the password to be generated, parameters are able to pass as an optional options object.

import { GeneratePassword } from "js-generate-password";
const password = GeneratePassword({
  length: 14,
  symbols: true,
});
console.log(password);

If no parameter is passed, the default parameter will be taken as :

options = {
  length: 10,
  lowercase: true,
  uppercase: true,
  numbers: true,
  symbols: false,
  exclude: "",
  minLengthLowercase: 1,
  minLengthUppercase: 1,
  minLengthNumbers: 1,
  minLengthSymbols: 0,
};

Available options

Any of these can be passed into the options object for each function.

Name Description Default Value
length Integer, length of password. 10
lowercase* Boolean, put lowercase letters in password true
uppercase* Boolean, put uppercase letters in password. true
numbers* Boolean, put numbers in password. true
symbols* Boolean, put symbols in password. false
exclude String, characters to be excluded from password. ''
minLengthLowercase only if lowercase is set to true, minLengthLowercase will create a password that will have minimum number of lower case characters in the password. 1
minLengthUppercase only if uppercase is set to true, minLengthUppercase will create a password that will have minimum number of upper case characters in the password. 1
minLengthNumbers only if numbers is set to true, minLengthNumbers will create a password that will have minimum number of numbers in the password. 1
minLengthSymbols only if symbols is set to true, minLengthSymbols will create a password that will have minimum number of symbols in the password. 1

*At least one should be true.

Example

  • No Options passed.
const {GeneratePassword} = require("js-generate-password");
const password = GeneratePassword();
console.log(password);

In the above case, no parameter is passed as option. Therefore the default values will be taken - which will have alphabets, both upper and lower case, numbers, and will be of length 10 characters.

xDU6izb3PV;
  • Length parameter passed.
const password = GeneratePassword({ length: 25 });
console.log(password);

The password generated is like this

U4c3KpQP5UrbZgTcrqMgFeI3R;
  • exclude parameter passed.
options={
      exclude : 'abc567XYZ';
      }
password = GeneratePassword(options);
console.log(password);

The generated password wouldn't has none of 'abc567XYZ' characters

J9yCfttQNj;
You might also like...
React-typescript-mini-project - Node Module Search With Typescript Reactjs and Redux
React-typescript-mini-project - Node Module Search With Typescript Reactjs and Redux

Node Module Search Getting Started It is project for freshers who want to learn

🚀 A boilerplate with generic configurations to a Nextjs project with bun, vitest, cicd and etc

🚀 A boilerplate with generic configurations to a Nextjs project with bun, vitest, cicd and etc

A Vision of Something Random
A Vision of Something Random

Backend: https://avsr.onrender.com/ Tech Stack TypeScript - TypeScript extends JavaScript by adding types to the language. NodeJS - Node.js® is a Java

Blog app using different modern technology like Next.js, ReactJS, TailwindCSS, GraphQL, GraphCMS, JavaScript, TypeScript, ...
Blog app using different modern technology like Next.js, ReactJS, TailwindCSS, GraphQL, GraphCMS, JavaScript, TypeScript, ...

Tony Blog Blog app using different modern technology like Next.js, ReactJS, TailwindCSS, GraphQL, GraphCMS, JavaScript, TypeScript, ... Link Blog: htt

YoutubeDownloader - A test project for learning React, Vue and TS

Requirements: Node.js 10.x Vue.JS 2.x Python 2.6+ FFMPEG Youtube-DL Installation Run command below in root directory npm install --production And inst

CLI based on Vite to generate your project easily
CLI based on Vite to generate your project easily

CLI based on Vite to generate your project easily

A ready to customize project to make a nice webapp using Node.js (Express.js) for the backend and React with Typescript and Redux for the frontend.

A ready to customize project to make a nice webapp using Node.js (Express.js) for the backend and React with Typescript and Redux for the frontend.

My project of personal blog using my knowledge in Node, Nest, React and Typescript

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Node.js / GraphQL project template pre-configured with TypeScript, PostgreSQL, login flow, transactional emails, unit tests, CI/CD workflow.
Node.js / GraphQL project template pre-configured with TypeScript, PostgreSQL, login flow, transactional emails, unit tests, CI/CD workflow.

Node.js API Starter Kit Node.js API Starter Kit is a project template for building Node.js backend applications optimized for serverless infrastructur

Owner
Ahmad Joya
Java Script, React JS, Next JS, Strapi, Parse Server and Blockchain-Smart Contract Developer.
Ahmad Joya
Locku-browser-extension - Simple Browser extension to save passwords across browsers

Locku A Simple browser extension for password management. Why another Password m

Solai Raj 3 Jul 27, 2022
A STARWARS EXERCISE STARWARS MOVIE CHARACTERS HIGHLIGHTS

A STARWARS EXERCISE STARWARS MOVIE CHARACTERS HIGHLIGHTS Stack Used ReactJs SASS for styling Short Description Star Wars is an American epic space ope

Collins Rollins 4 Dec 10, 2022
A plugin enables you to import a Markdown file as various formats on your vite project

vite-plugin-mdoc A plugin enables you to import a Markdown file as various forma

3lang 3 May 18, 2022
Docusaurus-react-native-plugin - A plugin to enable React Native Web and Reanimated on Docusaurus.

Docusaurus React Native Plugin A plugin to enable React Native Web and Reanimated on Docusaurus. Installation yarn add @gorhom/docusaurus-react-native

Mo Gorhom 28 Dec 14, 2022
A collection of 14 different React projects like Music Player, Weather App, Crypto Tracker, Chat Room, Currency Converter, COVID Tracker, To-do and Expense App, Color Generator etc.

Simple React Projects Note: If any project does not work Online download the project and run on your local Storage (Error is coming due to Local Stora

MD Yasin 22 Sep 15, 2022
This single-page app allows you to browse through 250 pokemon cards, filter them by type and open every single card to see its description

This single-page app allows you to browse through 250 pokemon cards, filter them by type and open every single card to see its description. I used React and Redux to fetch Pokemon data from the API.

Alejandro Ramos 3 Oct 25, 2022
EPYG: Every Place You Go WebSite Bulit Using React

MLH Project - EPYG EPYG: Every Place You Go! Try in link Vercel is used to upload this repository and you can check out this project here. (However, t

null 1 Dec 5, 2021
This is a minimal DApp that enables voting and vote tallying on the block chain

BlockChain Voting DApp This is a minimal DApp that enables voting and vote tallying on the block chain. It has a smart contract implemented in the sol

devdanny 5 Mar 12, 2022
Universal avatar makes it possible to fetch/generate an avatar based on the information you have about that user.

<Avatar> Universal avatar makes it possible to fetch/generate an avatar based on the information you have about that user. We use a fallback system th

Ambassify 601 Dec 12, 2022
Secure boilerplate for Electron app based on Vite. TypeScript + Vue/React/Angular/Svelte/Vanilla

Vite Electron Builder Boilerplate Vite+Electron = ?? This is a template for secure electron applications. Written following the latest safety requirem

Alex Kozack 1.5k Jan 4, 2023