Password Strength Tester Function Documentation

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

Examples

import { passwordStrengthTester } from 'multiform-validator';

const password = "P@ssw0rd123";

const customOptions = {
	isVeryWeak: (password, passwordLength) => passwordLength < 6,
	isWeak: (password, passwordLength) => passwordLength >= 6 && passwordLength < 8,
	isRegular: (password, passwordLength) => passwordLength >= 8 && passwordLength < 10,
	isStrong: (password, passwordLength) => passwordLength >= 10 && passwordLength < 12,
	isVeryStrong: (password, passwordLength) => passwordLength >= 12,
};

const customResult = passwordStrengthTester(password, customOptions);

console.log(customResult); // "Strong"