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

    Function isAmbeedProductListResponsePriceList

    • Type guard to validate if data matches the Ambeed price list item structure. Checks for required pricing fields including amount, USD price, discount, size, VIP price, and rate.

      Parameters

      • data: unknown

        The price list item to validate

      Returns data is AmbeedProductListResponsePriceList

      Type predicate indicating if the data is a valid AmbeedProductListResponsePriceList

      const priceItem = product.priceList[0];
      if (isAmbeedProductListResponsePriceList(priceItem)) {
      console.log("Price (USD):", priceItem.pr_usd);
      console.log("Size:", priceItem.pr_size);
      console.log("Discount:", priceItem.discount_usd);
      }
      export function isAmbeedProductListResponsePriceList(
      data: unknown,
      ): data is AmbeedProductListResponsePriceList {
      return ambeedProductListResponsePriceListSchema.safeParse(data).success;
      }