'use strict';

class Copyright {

    constructor(validator) {
        this.validator = validator;
    }

    getCurrentYearTemplate(currentYear) {
        this.validator.validateCurrentYear(currentYear);
        return `${currentYear}`;
    };

    getRangeTemplate(startYear, currentYear) {
        this.validator.validateRange(startYear, currentYear);
        return (startYear == currentYear) ? `${currentYear}` : `${startYear} - ${currentYear}`;
    };

    get(startYear, currentYear, format) {
        return (format == 'range') ?
            this.getRangeTemplate(startYear, currentYear) :
            this.getCurrentYearTemplate(currentYear);
    }

}

module.exports = Copyright;
'use strict';

class Copyright {

    constructor(validator) {
        this.validator = validator;
    }

    getCurrentYearFormat(currentYear) {
        this.validator.validateCurrentYear(currentYear);
        return `${currentYear}`;
    };

    getRangeFormat(startYear, currentYear) {
        this.validator.validateRange(startYear, currentYear);
        return (startYear == currentYear) ? `${currentYear}` : `${startYear} - ${currentYear}`;
    };

    get(startYear, currentYear, format) {
        return (format == 'range') ?
            this.getRangeFormat(startYear, currentYear) :
            this.getCurrentYearFormat(currentYear);
    }

}

module.exports = Copyright;
Refactor Copyright module