UNPKG

password-chacker-xqwe

Version:

A simple password strength checker with basic and advanced validation

37 lines (36 loc) 1.07 kB
export default function lengthValidator(password) { if(password.length < 8) { return { "score": 0, "length":{ "is_valid": false, "min_length": 8, "max_length": 128, "current_length": password.length, "message": "Password must be 8 characters long", } }; } else if(password.length < 24){ return { "score": 0.5, "length":{ "is_valid": true, "min_length": 8, "max_length": 128, "current_length": password.length, "message": "for your password must be 12 ", } }; }else { return { "score": 1, "length":{ "is_valid": true, "min_length": 8, "max_length": 128, "current_length": password.length, "message": "beater", } }; } }