public validateProperty()

in src/Updater.ts [69:96]


  public validateProperty() {
    if (!this.metadata) {
      throw new NotLoadedMetadataError();
    }

    const metadataTypes: string[] = [];

    if (this.metadata.type !== "idea" && this.metadata.type !== "tech") {
      metadataTypes.push("type");
    }

    if (this.metadata.emoji === "") {
      metadataTypes.push("emoji");
    }

    if (this.metadata.title === "") {
      metadataTypes.push("title");
    }

    if (typeof this.metadata.published !== "boolean") {
      metadataTypes.push("boolean");
    }

    if (metadataTypes.length !== 0) {
      const stringTypes = metadataTypes.join(", ");
      throw new InvalidMetadataError(stringTypes);
    }
  }