refactor(simulator): delete attributes instead of undefining
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 9 Mar 2023 21:31:05 +0000 (22:31 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 9 Mar 2023 21:31:05 +0000 (22:31 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index ce81671532f6af0689459a439c028b3b9d3beefa..6796bc95b7976085f95853fb46129bf27eaf2b71 100644 (file)
@@ -573,7 +573,7 @@ export class ChargingStation {
         this.sharedLRUCache.deleteChargingStationConfiguration(this.configurationFileHash);
         this.templateFileWatcher?.close();
         this.sharedLRUCache.deleteChargingStationTemplate(this.stationInfo?.templateHash);
-        this.bootNotificationResponse = undefined;
+        delete this.bootNotificationResponse;
         this.started = false;
         parentPort?.postMessage(MessageChannelUtils.buildStoppedMessage(this));
         this.stopping = false;
@@ -987,7 +987,7 @@ export class ChargingStation {
     this.stationInfo = this.getStationInfo();
     this.saveStationInfo();
     // Avoid duplication of connectors related information in RAM
-    this.stationInfo?.Connectors && delete this.stationInfo.Connectors;
+    delete this.stationInfo?.Connectors;
     this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl();
     if (this.getEnableStatistics() === true) {
       this.performanceStatistics = PerformanceStatistics.getInstance(
@@ -1317,7 +1317,7 @@ export class ChargingStation {
           this.templateFile
         } with connector ${connectorId} status configuration defined, undefine it`
       );
-      connectorStatus.status = undefined;
+      delete connectorStatus.status;
     }
   }
 
@@ -1878,7 +1878,7 @@ export class ChargingStation {
             ConnectorStatusEnum.Unavailable
           )
         );
-        this.getConnectorStatus(connectorId).status = undefined;
+        delete this.getConnectorStatus(connectorId)?.status;
       }
     }
   }