@xtsai/xai-utils
Version:
The xai-utils is an openai nodejs sdk compatible extension library.
34 lines • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isStrongPassword = isStrongPassword;
exports.isMiddelPassword = isMiddelPassword;
exports.isSimplePassword = isSimplePassword;
/**
* Check if the password is strong enough
* one lowercase letter, one uppercase letter, one number, one special character
* at least 8 characters
*/
function isStrongPassword(password) {
return /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/.test(password);
}
/**
* Check if the password is middle security
* one lowercase or uppercase letter, one number
* at least 6 characters
* @param password string
* @returns boolean
*/
function isMiddelPassword(password) {
return /^(?=.*[a-zA-Z])(?=.*\d)[A-Za-z\d@$!%*?#&]{6,}$/.test(password);
}
/**
* Check if the password is simple
* one lowercase or uppercase letter
* at least 6 characters
* @param password string
* @returns boolean
*/
function isSimplePassword(password) {
return /^(?=.*[a-zA-Z0-9])[A-Za-z\d@$!%*?&]{6,}$/.test(password);
}
//# sourceMappingURL=passport.validator.js.map