Re:Using Dispatch Tables to Avoid Conditionals in JavaScript
by vivin on Monday May 13, 2013 @11:21AM
(#5699156)
I've done something similar in my form-validation library. I have a function that has three inputs that basically end up behaving like flags. So there are 8 possibilities in total. I ended up creating a function that would return a three-bit binary number based on the inputs, and I also created a jump-table that maps the three-bit binary values to specific handlers.
[ Parent
| on HN ]
There are no comments on this comment yet.