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

advanced-password-generator

v1.2.0

Published

This advanced password generator creates customizable passwords with lowercase letters, uppercase letters, numbers, symbols, and hyphens. It can also generate Apple-style passwords (20 characters long) and assess password strength.

Downloads

70

Readme

Advanced Password Generator

  • This advanced password generator creates customizable passwords with lowercase letters, uppercase letters, numbers, symbols, and hyphens. It can also generate Apple-style passwords (20 characters long) and assess password strength.

Updates

  • New option: When the apple option is enabled, the function generates Apple-style passwords. These passwords are 20 characters long and include 16 lowercase letters, 1 uppercase letter, 1 number, and 2 hyphens.

Features

Generate passwords with:

  • Lowercase letters (optional)
  • Uppercase letters (optional)
  • Numbers (optional)
  • Symbols (optional)
  • Hyphens (optional)
  • Apple (optional)

Usage

Function Definition

  1. options: An object specifying which types of characters to include in the password and whether to check password strength.
  2. totalLength: The total length of the generated password.

Options

The options parameter is an object with the following properties:

  • lowercase: (boolean) Include lowercase letters in the password.
  • uppercase: (boolean) Include uppercase letters in the password.
  • numbers: (boolean) Include numbers in the password.
  • symbols: (boolean) Include symbols in the password.
  • hyphens: (boolean) Include hyphens (-) every 6 characters.
  • apple: (boolean) Generate a password in the style of Apple Password Generator, which is 20 characters long and includes 16 lowercase letters, 1 uppercase letter, 1 number, and 2 hyphens positioned after the 6th and 12th characters.
  • checkStrength: (boolean) Enables password strength evaluation based on length, character variety (lowercase, uppercase, numbers, symbols). Returns a strength assessment (e.g., Very Weak to Strong)

Example Usages

  • Example 1: Generate Apple-style password
var generatePassword = require('advanced-password-generator');

var options = {
    apple: true,
    checkStrength: true
};
var totalLength = 20;

var generatedPassword = generatePassword(totalLength, options);
console.log("Generated a password in the style of Apple Password Generator:", generatedPassword); 
//Example output: lxogiW-sbv9cv-jxmnzk, Password strength: Strong
  • Example 2: Lowercase Letters Only
var generatePassword = require('advanced-password-generator');

var options = {
    lowercase: true,
    uppercase: false,
    numbers: false,
    symbols: false,
    hyphens: false,
    apple: false,
    checkStrength: true
};
var totalLength = 10;

var generatedPassword = generatePassword(totalLength, options);
console.log("Generated password (lowercase only):", generatedPassword); 
//Example output: bpjjkriydb, Password strength: Very Weak

This will generate a password with 10 lowercase letters.

  • Example 3: Mixed Characters with Hyphens
var generatePassword = require('advanced-password-generator');

var options = {
    lowercase: true,
    uppercase: true,
    numbers: true,
    symbols: false,
    hyphens: true,
    apple: false,
    checkStrength: false
};
var totalLength = 20;

var generatedPassword = generatePassword(totalLength, options);
console.log("Generated password (uppercase and lowercase letters, numbers, hyphens):", generatedPassword); 
//Example output: hNfVdL-ZWnYH4-p2UaCb

This will generate a password with 20 characters that include uppercase letters, lowercase letters, numbers and hyphens for better readability.

  • Example 4: Mixed Characters with Default Options
var generatePassword = require('advanced-password-generator');

var totalLength = 20;

var generatedPassword = generatePassword(totalLength);
console.log("Generated password with Default Options:", generatedPassword); 
// Example output: fxP2O1-kw5aJ6-2KydFB

This will generate a password with 20 characters that include uppercase letters, lowercase letters, numbers, and hyphens for better readability. If no options are specified, the function will use the following defaults:

options = {
    lowercase: true,
    uppercase: true,
    numbers: true,
    symbols: false,
    hyphens: true,
    apple: false,
    checkStrength: false
};

This means you do not need to specify the options unless you want to customize them.

Notes

  • If both lowercase and uppercase are set to true, the password will include both uppercase and lowercase letters.
  • When hyphens is selected, the total length will include the hyphens, so the actual character count will be adjusted accordingly.
  • For Apple-style passwords, the total length cannot be changeable because Apple-style passwords are always 20 characters long.

License

Discord

  • Do you have a suggestion or complaint? Feel free to reach me on Discord with the nickname Ervel