From 234fd314119eea5f733b65eac9b2eba2dc94641f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sat, 26 Aug 2017 00:55:49 -0400 Subject: [PATCH] Clarify some `users.length` that were forgotten in a previous PR --- src/clientManager.js | 4 ++-- src/command-line/list.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/clientManager.js b/src/clientManager.js index c076494f..6211fb46 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -41,7 +41,7 @@ ClientManager.prototype.autoloadUsers = function() { process.exit(1); } - if (!users.length) { + if (users.length === 0) { log.info(noUsersWarning); } @@ -51,7 +51,7 @@ ClientManager.prototype.autoloadUsers = function() { const loaded = this.clients.map((c) => c.name); const updatedUsers = this.getUsers(); - if (!updatedUsers.length) { + if (updatedUsers.length === 0) { log.info(noUsersWarning); } diff --git a/src/command-line/list.js b/src/command-line/list.js index c6dc732f..d092ad8b 100644 --- a/src/command-line/list.js +++ b/src/command-line/list.js @@ -28,12 +28,12 @@ program return; } - if (!users.length) { - log.info(`There are currently no users. Create one with ${colors.bold("lounge add ")}.`); - } else { + if (users.length > 0) { log.info("Users:"); - for (var i = 0; i < users.length; i++) { - log.info(`${i + 1}. ${colors.bold(users[i])}`); - } + users.forEach((user, i) => { + log.info(`${i + 1}. ${colors.bold(user)}`); + }); + } else { + log.info(`There are currently no users. Create one with ${colors.bold("lounge add ")}.`); } });