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 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular-password-strength-analyzer

v0.5.1

Published

Analyze your password's strength

Downloads

1

Readme

Setting up in module's imports

import {AngularPasswordStrengthAnalyzerModule} from "angular-password-strength-analyzer";

AngularPasswordStrengthAnalyzerModule

Usage Password analyzer in ts

import {pwdWeightAnalyze, pwdWeightAnalyzeWithTitle} from "angular-password-strength-analyzer";

public password: string | null | undefined;
public passwordWeight: number | null | undefined;
public passwordStrength: string | null | undefined;
public passwordStrengthCustom: string | null | undefined;
public passwordWeightCustom: number | null | undefined;

checkPasswordStrength(): void {
  this.passwordWeight = pwdWeightAnalyze(this.password);
  this.passwordWeightCustom = pwdWeightAnalyze(this.password, 6);
  this.passwordStrength = pwdWeightAnalyzeWithTitle(this.password);
  this.passwordStrengthCustom = pwdWeightAnalyzeWithTitle(this.password, 6, [
    { max: 0, text: 'your text 1' },
    { min: 0, max: 30, text: 'your text 2' },
    { min: 30, max: 60, text: 'your text 3' },
    { min: 60, text: 'your text 4' },
  ]);
}

Usage Password analyzer in html

<input
  type="password"
  [(ngModel)]="password"
  (ngModelChange)="checkPasswordStrength()">
<p>Weight: {{passwordWeight}}</p>
<p>Strength is: {{passwordStrength}}</p>
<p>Custom Weight is: {{passwordWeightCustom}}</p>
<p>Custom Strength is: {{passwordStrengthCustom}}</p>
 NOTE: For password handling you can use `ngModel`, `rxjs` etc.

Usage pwdWeightAnalyze function

This is a TypeScript function that analyzes the strength of a password based on certain criteria and returns a score.

Criterias

  • If the password contains at least 3 digits
  • If the password contains at least 2 symbols
  • If the password contains both upper and lowercase letters
  • If the password contains both letters and digits
  • If the password contains both symbols and digits
  • If the password contains both letters and symbols
  • If the password consists only of letters or only of digits
NOTE: These criteria can be changed by specifying `analyzerOptions` in `pwdWeightAnalyze` and `pwdWeightAnalyzeWithTitle` functions

| Key | Type | Optional | Default value | |-------------------|----------------------------|----------|---------------------| | pwd | string | no | N/A | | minLength | number | yes | 8 | | analyzerOptions | IPasswordAnalyzerOptions | yes | default |

Output value is number - password's complexity

Usage pwdWeightAnalyzeWithTitle function

This is a TypeScript function that analyzes the strength of a password based on certain criteria and returns a score expressed in words.

Criterias

  • If the password weight is 0, then it is "empty"
  • If the password weight is greater than 1 and less than 34, then it is "weak"
  • If the password weight is greater than or equal to 35 and less than 67, then it is "good".
  • If the password weight is greater than or equal to 68, then it is "excellent"
NOTE: These criteria can be changed by specifying `options` in `pwdWeightAnalyzeWithTitle` function

| Key | Type | Optional | Default value | |-------------------|------------------------------|----------|---------------------| | pwd | string | no | N/A | | minLength | number | yes | 8 | | options | IPasswordStrengthOptions[] | yes | default | | analyzerOptions | IPasswordAnalyzerOptions | yes | default |

Output value is string - password's complexity's title

IPasswordAnalyzerOptions model

| Key | Type | Optional | Default value | |-------------------------------------------|-----------|-----------|---------------| | isActiveOptionCountDigits | boolean | yes | true | | isActiveOptionCountSpecialChars | boolean | yes | true | | isActiveOptionHasUpperCaseAndLowerCase | boolean | yes | true | | isActiveOptionHasLettersAndDigits | boolean | yes | true | | isActiveOptionHasSpecialCharsAndDigits | boolean | yes | true | | isActiveOptionHasLettersAndSpecialChars | boolean | yes | true | | isActiveOptionIsAllLettersOrAllDigits | boolean | yes | true |

IPasswordStrengthOptions model

| Key | Type | Optional | Default value | |--------|-----------|----------|----------------| | min | boolean | yes | N/A | | max | boolean | yes | N/A | | text | boolean | no | N/A |

Default model for IPasswordStrengthOptions[]

[
  { max: 0, text: 'empty' }, // don't remove it 
  { min: 1, max: 1, text: 'too short' }, // don't remove it 
  { min: 2, max: 34, text: 'weak' }, // your values
  { min: 35, max: 67, text: 'good' }, // your values
  { min: 68, text: 'excellent' }, // your values
]
NOTE: For empty password IPasswordStrengthOptions should be with max = 0
NOTE: For a password of insufficient length IPasswordStrengthOptions should be with min = 1 max = 1

Examples

| Password | pwdWeightAnalyze | pwdWeightAnalyzeWithTitle | Description | |----------------------------------|------------------|---------------------------|--------------| | mz.5J#[t | 97 | excellent | | | PjCvz2Qf | 27 | weak | | | p@$$word | 16 | weak | | | 1234567890 | 2 | weak | | | doggiesRcute! | 46 | good | | | 00000000000000000000000000000A | 3 | weak | | | 0 | 1 | too short | minLen = 2 | | 00 | 2 | weak | minLen = 2 | | 000 | 2 | weak | minLen = 2 | | 0000 | 2 | weak | minLen = 2 | | 00000 | 2 | weak | minLen = 2 |