Giter Site home page Giter Site logo

momohyusuf / password-helper Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 5 KB

A highly customizable lightweight NPM package that helps you check if password provided is a strong password

Home Page: https://www.npmjs.com/package/password-helper

License: MIT License

JavaScript 100.00%
package-manager password strong-password

password-helper's Introduction

Password helper

Description

This lightweight npm package provides a utility for checking the strength of passwords based on various criteria such as presence of uppercase and lowercase characters, digits, special characters, and minimum length. It returns a detailed result object containing information about the password strength and any missing criteria.

Installation

To install the package, you can use npm:

npm install password-helper

Usage

import { strongPassword } from "password-helper";
const password = "YourPassword123!";
const config = {
  lowercase: true, // Default is true
  uppercase: true, // Default is true
  digit: true, // Default is true
  special_character: true, // Default is true
  minimum_length: 6, // Default is 6
};

const result = strongPassword(password, config);
console.log(result);

Parameters

  • password: The password string to be checked.
  • config: An optional configuration object allowing customization of password criteria. The available configuration options are:
  • lowercase: Boolean value indicating whether the password must contain lowercase characters. Default is true.
  • uppercase: Boolean value indicating whether the password must contain uppercase characters. Default is true.
  • digit: Boolean value indicating whether the password must contain digits. Default is true.
  • special_character: Boolean value indicating whether the password must contain special characters. Default is true.
  • minimum_length: Integer value indicating the minimum length of the password. Default is 6.

Return Value

The function strongPassword returns an object with the following properties:

  • password_missing: An array containing messages indicating which criteria the password is missing.
  • score: An integer representing the strength score of the password. The maximum score is 100.
  • strength: A string indicating the strength level of the password (e.g., "weak", "medium", "strong").

Example Output

{
password_missing: ["Password must contain an uppercase character [A - Z]"],
score: 80,
strength: "medium"
}

Credits

This npm package is maintained by Momoh yusuf.

License

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

password-helper's People

Contributors

momohyusuf avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.