[polari] entryArea: Replace nested ternary operator
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] entryArea: Replace nested ternary operator
- Date: Wed, 14 Aug 2019 19:05:15 +0000 (UTC)
commit bf4c78035222a72bda6236d2884b8acde05547eb
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 7 00:05:25 2019 +0200
entryArea: Replace nested ternary operator
The ternary operator allows for concise code, but when starting to nest
it legibility suffers; replace it with a regular if-else statement in that
case.
https://gitlab.gnome.org/GNOME/polari/merge_requests/133
src/entryArea.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index f28c0b9..71f4a69 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -478,10 +478,12 @@ var EntryArea = GObject.registerClass({
}
_updateNick() {
- let channel = this._room ? this._room.channel : null;
- let nick = channel ?
- channel.connection.self_contact.alias :
- this._room ? this._room.account.nickname : '';
+ let { channel } = this._room || {};
+ let nick = '';
+ if (channel)
+ nick = channel.connection.self_contact.alias;
+ else if (this._room)
+ nick = this._room.account.nickname;
this._nickLabel.width_chars = Math.max(nick.length, this._maxNickChars);
this._nickLabel.label = nick;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]