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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pwd-gen-tiny

v0.1.3

Published

a lightweight JavaScript library for generating high-strength random passwords

Downloads

27

Readme

pwd-gen-tiny

中文文档

pwd-gen-tiny is a lightweight and flexible library for generating random passwords. It supports custom password length, character types, and minimum character counts. Ideal for scenarios requiring high-security passwords.

Installation

Install via npm:

npm install pwd-gen-tiny

Install via yarn:

yarn add pwd-gen-tiny

Usage

Basic Usage

import { generatePassword } from "pwd-gen-tiny";

const password = generatePassword({ length: 12 });
console.log(password); // Example output: "A3b@9kL2!xZ8"

Custom Options

const password = generatePassword({
  length: 16,
  includeUppercase: false, // Exclude uppercase letters
  includeSymbols: false, // Exclude symbols
  minNumbers: 4, // At least 4 numbers
  avoidAmbiguousChars: true, // Avoid ambiguous characters
});

console.log(password); // Example output: "k5m9n2p4q6r7s8t9"

API Documentation

generatePassword(options: PasswordOptions): string

Generates a random password.

Parameters

  • options (PasswordOptions): Configuration object with the following properties:

    • length (number): Password length (required).

    • includeUppercase (boolean, default true): Whether to include uppercase letters.

    • includeSymbols (boolean, default true): Whether to include symbols (!@#^&*).

    • minNumbers (number, optional): Minimum number of digits. If not provided, a random value is generated.

    • minSymbols (number, optional): Minimum number of symbols. If not provided, a random value is generated.

    • minUppercase (number, optional): Minimum number of uppercase letters. If not provided, a random value is generated.

    • avoidAmbiguousChars (boolean, default true): Whether to avoid ambiguous characters (e.g., 1-l, 0-oO).

Returns

string: The generated random password.

Examples

Example 1: Generate a Password with Symbols and Uppercase Letters

const password = generatePassword({ length: 10 });
console.log(password); // Example output: "A3b@9kL2!x"

Example 2: Generate a Password with Only Lowercase Letters and Numbers

const password = generatePassword({
  length: 8,
  includeUppercase: false,
  includeSymbols: false,
});

console.log(password); // Example output: "k5m9n2p4"

Example 3: Generate a Password with at Least 3 Numbers and 2 Uppercase Letters

const password = generatePassword({
  length: 12,
  minNumbers: 3,
  minUppercase: 2,
});

console.log(password); // Example output: "A3b@9kL2!xZ8"

Error Handling

If the parameters are invalid, generatePassword will throw an error:

  • If length is less than 1, throws "Password length must be greater than 0".

  • If includeUppercase is false but minUppercase is greater than 0, throws "When includeUppercase is false, minUppercase must be 0".

  • If the character pool is empty (e.g., all character types are disabled), throws "Character pool is empty. Please enable at least one character type.".

Contributing

Issues and Pull Requests are welcome! Please ensure code style consistency and pass all tests.

License

MIT