{"size": 608, "ext": "js", "max_stars_repo_path": "lib/Command.js", "max_stars_repo_name": "progdesigner/macro-js", "max_stars_repo_stars_event_min_datetime": "2022-01-20T02:26:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-20T02:26:48.000Z", "max_issues_repo_path": "lib/Command.js", "max_issues_repo_name": "progdesigner/macro-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/Command.js", "max_forks_repo_name": "progdesigner/macro-js", "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": 17.8823529412, "max_line_length": 89, "alphanum_fraction": 0.5065789474}

'use strict';

class Command {
    get name() {
        return this._name;
    }

    set name( value ) {
        this._name = value;
    }

    get handler() {
        return this._handler;
    }

    set handler( value ) {
        if (typeof value === 'function') {
            this._handler = value;
        }
    }

    constructor( props ) {
        this._name = typeof props.name === 'string' ? props.name : '';
        this._handler = typeof props.callback === 'function' ? props.callback : () => {};
    }

    execute( info ) {
        this._handler(this, info);
    }
}

module.exports = Command;
