DEV Community

Discussion on: How to write clean functions

Collapse
 
hongtat profile image
Yew Hong Tat

do you think isValidCoupon is more suitable than applyCouple in your use case?

const isValidCoupon = coupon && coupon.unused && isCouponCompatible(product, coupon);
Collapse
 
manu4216 profile image
Manuel Micu

Very good point 👍

Even the other Boolean could be better named to isSaleActive rather than applySale.

I'll make both changes.