do you think isValidCoupon is more suitable than applyCouple in your use case?
const isValidCoupon = coupon && coupon.unused && isCouponCompatible(product, coupon);
Very good point 👍
Even the other Boolean could be better named to isSaleActive rather than applySale.
I'll make both changes.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.