Password Strength Tester Function Documentation

The passwordStrengthTester function evaluates the strength of a given password and returns the type of password strength as a string. The possible strength types are: "veryWeak", "weak", "regular", "strong", or "veryStrong", based on specific criteria.

Import

The function can be imported using ES6 syntax from the "password-strength-tester" package:

import { passwordStrengthTester } from 'multiform-validator';

Alternatively, you can import the function using CommonJS syntax with require (Node.js):

const { passwordStrengthTester } = require('multiform-validator');

Parameters

The function takes one parameter, which must be a string representing the password to be evaluated.

Examples

const result1 = passwordStrengthTester("12345");
console.log(result1);  // Output: veryWeak

const result2 = passwordStrengthTester("abcdef");
console.log(result2); // Output: weak

const result3 = passwordStrengthTester("abc12345");
console.log(result3); // Output: regular

const result4 = passwordStrengthTester("Abc123awdasd");
console.log(result4); // Output: strong

const result5 = passwordStrengthTester("SuperSecurePassword123!@");
console.log(result5); // Output: veryStrong

Notes

The function checks the length of the password and applies certain criteria to classify the password strength. The returned strength type is based on the following criteria: