X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationUtils.ts;h=c10a3a15b229579523ad92fbf5efb679a8cf5961;hb=44eb6026079c8dc2c77b10a96a42d0c0b2da7c8f;hp=aa021663dba1ca2daac6bc3e84128ea1aaa39023;hpb=15068be99b2ca88b7b0e60f548c39fd1b06b2671;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index aa021663..c10a3a15 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -1,4 +1,4 @@ -import crypto from 'crypto'; +import crypto from 'node:crypto'; import path from 'path'; import { fileURLToPath } from 'url'; @@ -44,14 +44,12 @@ export class ChargingStationUtils { // In case of multiple instances: add instance index to charging station id const instanceIndex = process.env.CF_INSTANCE_INDEX ?? 0; const idSuffix = stationTemplate.nameSuffix ?? ''; - const idStr = '000000000' + index.toString(); + const idStr = `000000000${index.toString()}`; return stationTemplate?.fixedName ? stationTemplate.baseName - : stationTemplate.baseName + - '-' + - instanceIndex.toString() + - idStr.substring(idStr.length - 4) + - idSuffix; + : `${stationTemplate.baseName}-${instanceIndex.toString()}${idStr.substring( + idStr.length - 4 + )}${idSuffix}`; } public static getHashId(index: number, stationTemplate: ChargingStationTemplate): string { @@ -210,7 +208,7 @@ export class ChargingStationUtils { if (!Utils.isUndefined(template[key])) { logger.warn( `${logPrefix} Deprecated template key '${key}' usage in file '${templateFile}'${ - logMsgToAppend && '. ' + logMsgToAppend + logMsgToAppend && `. ${logMsgToAppend}` }` ); }