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

pass-lock

v1.0.1

Published

This is a JavaScript library for generating random passwords.

Downloads

10

Readme

Password Generator

This is a JavaScript library for generating random passwords.

Installation

  npm i pass-lock

Import

// ES6 Modules or TypeScript
import generator from 'pass-lock'

// CommanJS
const generator = require("pass-lock")

Basic Usage For Create Password

var password = generator.password() 

// result: !mR$d61O

Basic Usage For Create Memorable

var password = generator.memorable()

// result: churn-fable-urine-human

Basic Usage For Create Number

var password = generator.number() 

// result: 48343074

Options For Number

The following options can be passed to the options object for the number function in this library:

| Name | Description | Default Value | |-------------------|-------------------------------------------------------|---------------| | length | An integer that specifies the password length. | 8 | | specificDigits | An array of specific digits to include in the password. | null | | quantity | An integer that determines the number of passwords to generate. | 1 |

Example

var password = generator.number({ 
    length: 8, 
    quantity: 4, 
    specificDigits:[4,7,8,2] 
  }) 

// result: [ '42824882', '72484722', '28842287', '28478284' ]
var password = generator.number({
    length: 6, 
    quantity: 5
  }) 

// result: [ '558343', '694994', '405494', '665645', '557931' ]

Options For Memorable

The following options can be passed to the options object for the memorable function in this library:

| Name | Description | Default Value | |-------------------|-------------------------------------------------------|---------------| | length | An integer specifying the password length. | 4 | | customWordList | A boolean to include a custom word list in the password. | null | | uppercase | A boolean or a string to specify the inclusion of uppercase characters. | false | | lowercase | A boolean to include lowercase characters in the password. | true | | capitalize | A boolean to start the password with a capital letter. | false | | quantity | An integer to determine the number of passwords to generate. | 1 |

Example

var password = generator.memorable({ 
    length: 6, 
    quantity:4, 
    uppercase: true 
  })    
/*
  result: [
              'NIGHT-VOTER-BEADY-MISER-WRYLY-CABAL',
              'CHOKE-CURRY-BLAME-ARSON-GRACE-SWORD',
              'GIANT-WAIVE-BUGGY-VAULT-FINCH-CRUSH',
              'JELLY-PRISM-WHICH-ALTER-SHARP-SPIED'
            ]
*/
data = ['Sunshine', 'Mountain', 'Delicious', 'Butterfly', 'Adventure',
    'Serendipity', 'Harmony', 'Freedom', 'Vibrant', 'Tranquility']

var password = generator.memorable({
    length: 4,
    quantity: 5,
    capitalize: true,
    customWordList: data
})

/*   
  result: [
              'Butterfly-Tranquility-Freedom-Mountain',
              'Freedom-Mountain-Tranquility-Vibrant',
              'Tranquility-Sunshine-Butterfly-Mountain',
              'Adventure-Adventure-Butterfly-Sunshine',
              'Vibrant-Mountain-Freedom-Mountain'
            ]
*/

Options For Password

The following options can be passed to the options object for the password function in this library:

| Name | Description | Default Value | |-------------------|-------------------------------------------------------|---------------| | length | An integer specifying the password length. | 8 | | uppercase | A boolean or a string to specify the inclusion of uppercase characters. | true | | lowercase | A boolean to include lowercase characters in the password. | true | | capitalize | A boolean to start the password with a capital letter. | true | | symbols | A boolean or a string to specify symbol to be included in the password. | true | | numbers | A boolean to indicate whether to include numbers in the password. | true | | quantity | An integer to determine the number of passwords to generate. | 1 |

Example

var password = generator.password({
    length:10, 
    numbers: true, 
    symbols: true
  }) 

// result: [|43%:2&7>
var password = generator.password({
    length:10, 
    numbers: true, 
    symbols: true, 
    quantity: 4, 
    uppercase: true
  }) 

// result: [ 'YD66]_SF;L', 'H$M>Z(+E!I', '(MI9R9>,[Z', 'PQ3;?)>C^^' ]
var password = generator.password({
    length:10, 
    numbers: true, 
    symbols: '^+%', 
    quantity: 3
  })

// result: [ '34625^2548', '%^8910%0+0', '7+675%%430' ]