ChemPal Documentation - v1.6.0
    Preparing search index...

    Function isVWRSearchResponse

    • Type guard validating a VWR product search response. Requires a products array whose entries each carry at least a code and a baseProduct id (other fields are tolerated).

      Parameters

      • data: unknown

        The response to validate

      Returns data is VWRSearchResponse

      Type predicate indicating whether data is a VWRSearchResponse

      isVWRSearchResponse({ products: [{ code: "NA3626344", baseProduct: "11805968" }] }); // true
      isVWRSearchResponse({ products: [{ code: "NA3626344" }] }); // false (missing baseProduct)
      export function isVWRSearchResponse(data: unknown): data is VWRSearchResponse {
      return v.safeParse(vwrSearchResponseSchema, data).success;
      }