The object to validate
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;
}
Type guard to validate if an object is a valid Magento 2 Money payload. Verifies that both the numeric
valueand ISOcurrencystring are present.