CanopyTax / kremling

Embarrassingly simple css for React
https://kremling.js.org
Apache License 2.0
36 stars 4 forks source link

Proposal: whenTruthy #46

Closed joeldenning closed 4 years ago

joeldenning commented 4 years ago

Sometimes I want to apply a class if it’s present. You can do this with maybe(), but you actually have to do maybe(myKlass || ‘’, myKlass) in order for kremling to not get mad about a false className. I think an easier apis would be this:

whenTruthy(myKlass)

joeldenning commented 4 years ago

Turns out that always() already supports this. If the argument provided to always is not a string, it defaults to an empty string.