ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...
    • Type guard to validate if an object is a valid Magento 2 Money payload. Verifies that both the numeric value and ISO currency string are present.

      Parameters

      • value: unknown

        The object to validate

      Returns value is Magento2Money

      Type predicate indicating if the value is a valid Magento2Money

      const money = { value: 9.9, currency: "USD" };
      if (isMagento2Money(money)) {
      console.log("Valid money:", money.currency, money.value);
      }
      export function isMagento2Money(value: unknown): value is Magento2Money {
      return magento2MoneySchema.safeParse(value).success;
      }