checkIfValid()

in ui/rules.js [31:47]


  checkIfValid() {
    if (!this.id) {
      throw new Error("ID is required when defining a rule.")
    }

    if (!this.description) {
      throw new Error("Description is required when defining a rule.")
    }

    if (this.inputs && (!this.format || typeof this.format !== "function")) {
      throw new Error("Format function is required when your rule has inputs.")
    }

    if (this.inputs && this.inputs.some(input => !["text", "dropdown"].includes(input.type))) {
      throw new Error("Only support text or dropdown type");
    }
  }