From: Jérôme Benoit Date: Sun, 26 Nov 2023 22:55:02 +0000 (+0100) Subject: refactor: cleanup undefined handling X-Git-Tag: v1.2.27~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f1bd9d1970f24c8234582c82fcd58c806391b78b;p=e-mobility-charging-stations-simulator.git refactor: cleanup undefined handling Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index ce0ba3e3..13721bd6 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -76,7 +76,7 @@ export const getChargingStationId = ( index: number, stationTemplate: ChargingStationTemplate | undefined, ): string => { - if (isUndefined(stationTemplate)) { + if (stationTemplate === undefined) { return "Unknown 'chargingStationId'"; } // In case of multiple instances: add instance index to charging station id @@ -85,7 +85,7 @@ export const getChargingStationId = ( const idStr = `000000000${index.toString()}`; return stationTemplate?.fixedName ? stationTemplate.baseName - : `${stationTemplate?.baseName}-${instanceIndex.toString()}${idStr.substring( + : `${stationTemplate.baseName}-${instanceIndex.toString()}${idStr.substring( idStr.length - 4, )}${idSuffix}`; };