title: Replacing Switch-Case with something better?
body: <p>I am working on a Web chat application. The code you see above is used to process data from responses received in JSON format. Basically how it works is an Ajax long-poll request is sent to the server, which pulls the messages that need to be sent to the user. Outputs in JSON format, parsed by JS, and then Minte.Processor.process(json) is called to handle the rest. </p>
  
  <p>I would like to replace the switch statement with something else. As you can see there are quite a few commands (and I'm estimating at least 50 more) so I need a more elegant solution. I was thinking of creating an object that holds an array of key-value pairs where the key is the command name and value is data, but I don't know if that is less efficient than switch. </p>