case.js 398 B

12345678910111213141516171819202122232425
  1. import { Command } from './command';
  2. export class Case extends Command {
  3. constructor (expression) {
  4. super();
  5. this.expression = expression;
  6. /**
  7. * @type {Command[]}
  8. */
  9. this.commands = [];
  10. }
  11. /**
  12. *
  13. * @param {Command[]} commands
  14. */
  15. setCommands (commands) {
  16. this.commands = commands;
  17. }
  18. get isDefault () {
  19. return this.expression === null;
  20. }
  21. }