vendredi 7 août 2015

Which pattern would you use to solve that kind of expression?

I have multiple states and multiple values, and well, I can use a function, else if logic, but want to know your opinion about which design pattern or implementation is better for this kind of casuistry:

item.status == 'upcoming' ? 
     'label-upcoming' : 
        ( item.type == 'ticket_required' && 
            item.status == 'available' && 
              item.hasTicket == true ? 
                 'label-ticket' : '')

I don´t want a solution, just learn some technics. Thanks in advance

Aucun commentaire:

Enregistrer un commentaire