From: Jérôme Benoit Date: Tue, 7 Feb 2023 21:05:01 +0000 (+0100) Subject: fix(simulator): detect string emptiness properly without helper usage X-Git-Tag: v1.1.93~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=8d54dcc02f185433399891be628fe8ce7658e2d1;p=e-mobility-charging-stations-simulator.git fix(simulator): detect string emptiness properly without helper usage Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 2cba674d..c71b3ee5 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -339,13 +339,13 @@ export default class Configuration { ) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage in section '${sectionName}'${ - logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}` + logMsgToAppend.trim().length > 0 && `. ${logMsgToAppend}` }}` ); } else if (!Configuration.isUndefined(Configuration.getConfig()[key])) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${ - logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}` + logMsgToAppend.trim().length > 0 && `. ${logMsgToAppend}` }}` ); } @@ -376,7 +376,7 @@ export default class Configuration { private static getConfigurationFileWatcher(): fs.FSWatcher | undefined { try { return fs.watch(Configuration.configurationFile, (event, filename): void => { - if (filename?.trim().length !== 0 && event === 'change') { + if (filename?.trim().length > 0 && event === 'change') { // Nullify to force configuration file reading Configuration.configuration = null; if (!Configuration.isUndefined(Configuration.configurationChangeCallback)) { @@ -432,7 +432,7 @@ export default class Configuration { logPrefix: string, params: HandleErrorParams = { throwError: true } ): void { - const prefix = logPrefix?.trim().length !== 0 ? `${logPrefix} ` : ''; + const prefix = logPrefix?.trim().length > 0 ? `${logPrefix} ` : ''; let logMsg: string; switch (error.code) { case 'ENOENT':