DRY map lookup

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-10-06 12:16:54 +01:00
parent 91ba939e23
commit 152499a17d
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E

View File

@ -310,7 +310,7 @@ const stateHandlers = {
module.exports = {
textForEvent: function(ev) {
const handler = ev.isState() ? stateHandlers[ev.getType()] : handlers[ev.getType()];
const handler = (ev.isState() ? stateHandlers : handlers)[ev.getType()];
if (handler) return handler(ev);
return '';
},