The exception would be if the more "complex" solution was more performant.
For verification, I ran a perf test on the two funcs, and the switch idiom won out. (see screenshot below).
If another idiom were to beat out the switch idiom, I would swap out the implementation for the fastest idiom that uses the least cycles.
Wrap it in a function, document it, and include a resource link to the performance notes, tests and reasoning of the chosen implementation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The exception would be if the more "complex" solution was more performant.
For verification, I ran a perf test on the two funcs, and the switch idiom won out. (see screenshot below).
If another idiom were to beat out the switch idiom, I would swap out the implementation for the fastest idiom that uses the least cycles.
Wrap it in a function, document it, and include a resource link to the performance notes, tests and reasoning of the chosen implementation.