Replace deprecated string helper usage
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 8 Mar 2022 19:37:19 +0000 (20:37 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 8 Mar 2022 19:37:19 +0000 (20:37 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index ebd77f83ac54a4d5303712ffcd69a5f78705e81c..76efaf55a7db13e10fd37e99d168591b52cb3d16 100644 (file)
@@ -653,14 +653,13 @@ export default class ChargingStation {
     // 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' + this.index.toString();
     return stationTemplate.fixedName
       ? stationTemplate.baseName
       : stationTemplate.baseName +
           '-' +
           instanceIndex.toString() +
-          ('000000000' + this.index.toString()).substr(
-            ('000000000' + this.index.toString()).length - 4
-          ) +
+          idStr.substring(idStr.length - 4) +
           idSuffix;
   }