ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function isAmbeedProductListResponseResultItem

    • Type guard to validate if data matches the Ambeed product result item structure. Checks for required product fields including product ID, price list, name, molecular formula, URL, English name, and CAS number.

      Parameters

      • data: unknown

        The result item to validate

      Returns data is AmbeedProductListResponseResultItem

      Type predicate indicating if the data is a valid AmbeedProductListResponseResultItem

      const item = resultList[0];
      if (isAmbeedProductListResponseResultItem(item)) {
      console.log("Product:", item.p_name_en);
      console.log("CAS:", item.p_cas);
      console.log("URL:", item.s_url);
      }
      export function isAmbeedProductListResponseResultItem(
      data: unknown,
      ): data is AmbeedProductListResponseResultItem {
      return ambeedProductListResponseResultItemSchema.safeParse(data).success;
      }