The Password Checker returns a count of steps to pass the validation.
This is a solution for the challenge.
npm
npm i strong-password-checker
yarn
yarn add strong-password-checker
Also, you can download a minified js file
here.
It adds only strongPasswordChecker
to global scope.
This is a pure function, just provide a password and get the result.
import strongPasswordChecker from 'strong-password-checker'
strongPasswordChecker('a') // 5
You may use optional arguments, they have default values
function strongPasswordChecker (
pass: string,
minLength = 6,
maxLength = 20,
maxRepeat = 3,
charConditions = [/[0-9]/, /[a-z]/, /[A-Z]/]
): number {}
If you find a bug or have a suggestion, please file an issue on GitHub.