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

    Function isAmbeedSearchResponseProduct

    • Type guard to validate if data matches the Ambeed search response product structure. Uses the same schema as the product list response for validation.

      Parameters

      • data: unknown

        The search response product to validate

      Returns data is AmbeedSearchResponseProduct

      Type predicate indicating if the data is a valid AmbeedSearchResponseProduct

      const product = searchResults[0];
      if (isAmbeedSearchResponseProduct(product)) {
      console.log("Source:", product.source);
      console.log("Code:", product.code);
      }
      export function isAmbeedSearchResponseProduct(data: unknown): data is AmbeedSearchResponseProduct {
      return ambeedProductListResponseSchema.safeParse(data).success;
      }