How to Refactor Long If or Switch Blocks with Double Dispatch in JavaScript | Hacker News Reader