{"size": 901, "ext": "js", "max_stars_repo_path": "EcmaScript/program/app/simplePeel.js", "max_stars_repo_name": "jason-kerney/PeelAndSlice", "max_stars_repo_stars_event_min_datetime": "2018-04-25T20:51:51.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-18T21:47:54.000Z", "max_issues_repo_path": "EcmaScript/program/app/simplePeel.js", "max_issues_repo_name": "jason-kerney/PeelAndSlice", "max_issues_repo_issues_event_min_datetime": "2020-09-04T12:47:03.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-06T21:48:35.000Z", "max_forks_repo_path": "EcmaScript/program/app/simplePeel.js", "max_forks_repo_name": "jason-kerney/PeelAndSlice", "max_forks_repo_forks_event_min_datetime": "2017-04-11T21:26:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-11T15:01:54.000Z"}
{"max_stars_count": 6, "max_issues_count": 2, "max_forks_count": 4, "avg_line_length": 39.1739130435, "max_line_length": 141, "alphanum_fraction": 0.6881243063}
// The Worst of Legacy Code: Forensic Development

function calulateTotalMortage(name, db) {
    const personLoader = require('./ignored/person');
    const person = personLoader.LoadPersonByName(name, db);

    if(Boolean(person.getFinancalInformation().getHomeEquityLoan()) || person.getFinancalInformation().getHomeEquityLoan() === 0) {
        return (
            person.getFinancalInformation().getHomeEquityLoan() + 
            (Boolean(person.getFinancalInformation().getFirstMortagePayment()) 
                ? person.getFinancalInformation().getFirstMortagePayment() 
                : 0)
        );
    }
    if(Boolean(person.getFinancalInformation().getFirstMortagePayment()) || person.getFinancalInformation().getFirstMortagePayment() === 0) {
        return person.getFinancalInformation().getFirstMortagePayment();
    }
    return 0;
}

module.exports = {
    calulateTotalMortage
}