hubot-command-mapper
Version:
Helps with mapping tools and commands to Hubot.
34 lines (33 loc) • 874 B
JavaScript
/**
* Base class for a parameter.
*
* @export
* @abstract
* @class ParameterBase
* @implements {IParameter}
*/
export class ParameterBase {
name;
defaultValue;
/**
* Indicates that this parameter is optional.
* A user does not have to provide a value
* in order for this command to be valid.
*
* @readonly
* @memberof ParameterBase
*/
get optional() {
return this.defaultValue != null;
}
/**
* Creates an instance of ParameterBase.
* @param {string} name The name of the parameter. Can be used to identify the parameter value as well.
* @param {any} [defaultValue=null] When a value is given, the parameter becomes optional.
* @memberof ParameterBase
*/
constructor(name, defaultValue = null) {
this.name = name;
this.defaultValue = defaultValue;
}
}