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

unique-login-credential

v1.0.2

Published

A package for generating unique passwords and usernames.

Downloads

16

Readme

Unique Login Credential

unique-login-credential is a versatile Node.js package designed to generate secure and customizable passwords and usernames. It allows you to specify various parameters to tailor the generated credentials to your specific needs. Whether you're building a new application or enhancing an existing one, this package provides an easy-to-use solution for credential generation.

Features

  • Customizable Password Generation: Specify the length and composition of your passwords, including capital letters, small letters, numbers, and special characters.
  • Flexible Username Generation: Add prefixes and define the character composition for usernames.
  • Support for ES Modules and CommonJS: Compatible with various JavaScript module systems.

Installation

To install the package, use npm:

npm install unique-login-credential

Usage

ES Modules

If your project uses ES modules, you can import the functions using import statements:

import { uniquePassword, uniqueUsername } from 'unique-login-credential';

// Generate a password with specific options
const password = uniquePassword({
  length: 12,
  capitalLetter: 2,
  smallLetter: 4,
  number: 3,
  specialCharacter: 2,
  random: true
});
console.log(`Generated Password: ${password}`);

// Generate a username with specific options
const username = uniqueUsername({
  prefix: 'user_',
  length: 10,
  capitalLetter: 2,
  smallLetter: 5,
  number: 2,
  specialCharacter: 1,
  random: true
});
console.log(`Generated Username: ${username}`);

CommonJS

For projects using CommonJS modules, import the functions using require:

const { uniquePassword, uniqueUsername } = require('unique-login-credential');

// Generate a password with specific options
const password = uniquePassword({
  length: 12,
  capitalLetter: 2,
  smallLetter: 4,
  number: 3,
  specialCharacter: 2,
  random: true
});
console.log(`Generated Password: ${password}`);

// Generate a username with specific options
const username = uniqueUsername({
  prefix: 'user_',
  length: 10,
  capitalLetter: 2,
  smallLetter: 5,
  number: 2,
  specialCharacter: 1,
  random: true
});
console.log(`Generated Username: ${username}`);

Functions

uniquePassword(options)

Generates a unique and secure password based on the provided options.

Parameters:

  • options: An object with the following properties:
    • length (number): Total length of the password. The minimum value should be the sum of capitalLetter, smallLetter, number, and specialCharacter. Default: 8
    • capitalLetter (number): Number of capital letters to include. Default: 1
    • smallLetter (number): Number of small letters to include. Default: 3
    • number (number): Number of numeric digits to include. Default: 2
    • specialCharacter (number): Number of special characters to include. Default: 2
    • random (boolean): Whether to shuffle the characters in the password randomly. Default: false

Returns: A randomly generated password as a string.

Example:

const password = uniquePassword({
  length: 12,
  capitalLetter: 2,
  smallLetter: 4,
  number: 3,
  specialCharacter: 2,
  random: true
});
console.log(password); // Example output: "A1b@C2d!Ef3G"

uniqueUsername(options)

Generates a unique username based on the provided options.

Parameters:

  • options: An object with the following properties:
    • prefix (string): A prefix to add at the beginning of the username. Default: ""
    • length (number): Total length of the username, including the prefix. The minimum length should be the sum of capitalLetter, smallLetter, number, specialCharacter, and the length of the prefix. Default: 6
    • capitalLetter (number): Number of capital letters to include. Default: 1
    • smallLetter (number): Number of small letters to include. Default: 3
    • number (number): Number of numeric digits to include. Default: 2
    • specialCharacter (number): Number of special characters to include. Default: 0
    • random (boolean): Whether to shuffle the characters in the username randomly. Default: false

Returns: A randomly generated username as a string.

Example:

const username = uniqueUsername({
  prefix: 'user_',
  length: 10,
  capitalLetter: 2,
  smallLetter: 5,
  number: 2,
  specialCharacter: 1,
  random: true
});
console.log(username); // Example output: "user_a1B2cD@"

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch for your changes (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a pull request describing your changes.

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.