npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generate-password-lite

v1.0.0

Published

Password Generator for using in javascript/typescript based projects.

Downloads

117

Readme

generate-password-lite

generate-password-lite is usable for every typescript 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 generate-password-lite

or

yarn add generate-password-lite

Usage

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

import { GeneratePassword } from "generate-password-lite";

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 } = "generate-password-lite";

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;

License

generate-password-lite is licensed under the MIT License. See the LICENSE file for more details.