Hacker News new | past | comments | ask | show | jobs | submit login

If you're running through that many conditionals, it may be clearer to work them into a state enum that you can use with a switch.

Golang doesn't have enums

Neither does JS, but there are ways to accomplish the same thing[0].

[0] https://stackoverflow.com/questions/14426366/what-is-an-idio...

TypeScript does and it’s one of my favorite features.

That's not really the same. That's badly designed and error prone.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact