Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

pass-score

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pass-score

Get the score of your password

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

Travis CI Github Build Codacy Badge Codebeat Badge CodeFactor Badge DeepScan grade Analytics

Pass Score

Get the score of your password as a number.

The number can be between 0 and the length of the provided array containing the conditions against which the password will be tested.

Visitor stats

GitHub stars GitHub forks GitHub watchers GitHub followers

Code stats

GitHub code size in bytes GitHub repo size GitHub language count GitHub top language GitHub last commit

Install

npm i pass-score

or

yarn add pass-score

Usage

First import the function

import passScore from 'pass-score';

// or

import { passScore } from 'pass-score';

Then use it with the default patterns:

// Returns a number between 0 and 4
const score = passScore('Your-passW0rd-Str1ng');

Or with custom patterns:

// Returns a number between 0 and 2
const score = passScore('Your-passW0rd-Str1ng', [
	/[\W_,!?@*\(\)]/, // Special characters
	/^.{8}/ // At least 8 characters
]);

Arguments

The function accepts two arguments:

  • The first is the password string. It is required.
  • The second is an array of regular expressions. It is optional. The default array is shown below.

Conditions

The predefined array with conditions contains the following:

  • /\d/ - The password should contain at least on digit
  • /[A-Z]/, - The password should contain at least one uppercase letter
  • /[\W_,!?@*\(\)]/ - The password should contain at least one special character
  • /^.{8}/ - The password should be at least 8 characters long

Bonus

The pass-score module provides a native web component. In order to use it you can import it:

import 'pass-score/component';

and then use it as shown in the demo.

The component accepts one attribute patterns which is a comma separated list of regular expressions against which the password will be matched.

LICENSE

MIT

Connect with me:

Support and sponsor my work:

Keywords

Pass score

FAQs

Package last updated on 19 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts