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

z-generate-password

v1.0.2

Published

A tiny, easy to use javascript password generator

Downloads

375

Readme

A 📦 tiny, 🚀 fast, 🎨 customizable password generator of javascript implement.

Default run as chrome builtin password generator.

ts license mini zipped size dependents coverage tree-shaking support npm version

[English / 中文]

✨ Features

  • 🚀 Run fast (~1m ops/s by default, ~1.3m ops/s without shuffle [MacBook Air (M1, 2020) 16G])
  • 🛡 Strong password have over 88 bits of entropy and fully tested
  • 🎨 Fully customizable and readability (no similar chars or sequences of -/_)
  • 📦 Tiny and tree shaking support
  • 🌎 Support web, Node and service worker with esm, cjs amd umd

🎬 Quick Start

Install

npm i z-generate-password

Usage

import generatePassword from 'z-generate-password';

console.log(generatePassword());
// yacpVZuF3TSQAjZn

Passwords like

b2qaDfrH9BceXRWC
F68dVNajxdDUFRyq
9SXfA7u6rY4Ze57y
tF8BDUAb2TPS4S5y
2KVrtvTeGSwirJ8U
gSgSva3jy8ZYYtQh
yyRPhaf2jcMR2CVF
D4qfBTjfNNs96aWR
7sZZt69NdBtFJAPg
WgZmyt24DdLAAy5v
gS9Cjex2NkKie4c2

Default generate rules

  • Must have lowercase char
  • Must have uppercase char
  • Must have digit
  • No sequences of -/_

Default chars

// exclude `l`, `o`
const DefaultLowerCaseChars = 'abcdefghijkmnpqrstuvwxyz';
// exclude 'I', 'O'
const DefaultUpperCaseChars = 'ABCDEFGHJKLMNPQRSTUVWXYZ';
// exclude '1'
const DefaultDigits = '23456789';
// symbols
const DefaultSymbols = '-_.:!';

Removed chars (for readability)

  • l (lowercase letter L)
  • I (capital letter i)
  • 1 (digit one)
  • O (capital letter o)
  • 0 (digit zero)
  • o (lowercase letter O)

🎨 Options

Interface

{
    /** length of the password, pass a [min, max] as length range */
    length?: number | [number, number] | undefined;
    /** custom your symbol collection */
    symbols?: string | true | undefined;
    /** custom your digit collection */
    digits?: string | undefined;
    /** custom your lowercase char collection */
    lowerCaseChars?: string | undefined;
    /** custom your uppercase char collection */
    upperCaseChars?: string | undefined;
    /** add your own char collection */
    customChars?: string | undefined;
}

Usage

const newPassword = generatePassword({
    length: [10, 20]
});
// EN3RBGJ3kG2A59SThy

Use cases

  • custom password length

with fixed length

const newPassword = generatePassword({
    length: 18
});
// dJmFRniJ7gvWBq3vZp

with length range

const newPassword = generatePassword({
    length: [10, 20]
});
// EN3RBGJ3kG2A59SThy
  • custom symbols

with default symbols

const newPassword = generatePassword({
    symbols: true
});
// MS2_!U9ni.4QHaMk

with custom symbols

const newPassword = generatePassword({
    symbols: '@&*^'
});
// q2V^ppADRVEC3BVb
  • custom lowerCaseChars/upperCaseChars/digits

null to disabled some chars

const newPassword = generatePassword({
    digits: null
});
// fcQDHXaPWgsTtdUD

custom chars

const newPassword = generatePassword({
    lowerCaseChars: 'abc'
});
// aTZc9FC2T292Q24b
  • add custom chars
const newPassword = generatePassword({
    customChars: '我是中国人'
});
// RVg59M6CKP中i国4zT