Re:Using the switch(true) pattern in JavaScript
by fl0wenol on Monday April 12, 2021 @02:12PM
(#26782956)
Agreed, +1
This pattern goes beyond JS and is very helpful for supporting tests; you've already factored out your validators. There's always going to be stragglers but you can define and push in an extra check on the spot (i.e. using lambda funcs at least in JS).
[ Parent
| on HN ]
There are no comments on this comment yet.