Rewrite conditional as switch

This is actually what the code tries to do, the conditional just
makes it harder to read
This commit is contained in:
Reto Brunner 2021-12-04 11:49:28 +01:00
parent 1953e03253
commit 514c6fbf95

View File

@ -42,16 +42,19 @@ class Msg {
return !!this.from.nick; return !!this.from.nick;
} }
return ( switch (this.type) {
this.type !== Msg.Type.MONOSPACE_BLOCK && case Msg.Type.MONOSPACE_BLOCK:
this.type !== Msg.Type.ERROR && case Msg.Type.ERROR:
this.type !== Msg.Type.TOPIC_SET_BY && case Msg.Type.TOPIC_SET_BY:
this.type !== Msg.Type.MODE_CHANNEL && case Msg.Type.MODE_CHANNEL:
this.type !== Msg.Type.MODE_USER && case Msg.Type.MODE_USER:
this.type !== Msg.Type.RAW && case Msg.Type.RAW:
this.type !== Msg.Type.WHOIS && case Msg.Type.WHOIS:
this.type !== Msg.Type.PLUGIN case Msg.Type.PLUGIN:
); return false;
default:
return true;
}
} }
} }