{"size": 1090, "ext": "js", "max_stars_repo_path": "DAY 12/utils/Validetails.js", "max_stars_repo_name": "deepsingh9868/DEVNEST-backend", "max_stars_repo_stars_event_min_datetime": "2021-09-14T18:14:40.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-14T18:14:40.000Z", "max_issues_repo_path": "DAY 12/utils/Validetails.js", "max_issues_repo_name": "deepsingh9868/DEVNEST-backend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "DAY 12/utils/Validetails.js", "max_forks_repo_name": "deepsingh9868/DEVNEST-backend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.1428571429, "max_line_length": 82, "alphanum_fraction": 0.576146789}
const email_validator= require('email-validator');
const password_validator = require('password-validator');
var schema = new password_validator();

const checkusername = (username)  =>{
    schema
    .is().min(5)
    .is().max(30)
    .has().lowercase()

    console.log(schema.validate(username));
    return schema.validate(username);

}

const checkemail = (email)=>{
    console.log(email_validator.validate(email));
    return email_validator.validate(email);
}


const checkpassword = (password) =>{
    schema
    .is().min(5)                                    // Minimum length 8
    .is().max(100)                                  // Maximum length 100
    .has().uppercase()                              // Must have uppercase letters
    .has().lowercase()                              // Must have lowercase letters
    .has().digits(1)                                // Must have at least 2 digits
    .has().not().spaces() 
    
    console.log(schema.validate(password));
    return schema.validate(password);
}

module.exports = {checkusername, checkemail, checkpassword}