UNPKG

hubot-command-mapper

Version:
34 lines (33 loc) 874 B
/** * 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; } }