Strict boolean checks
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 19 Oct 2022 09:02:20 +0000 (11:02 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 19 Oct 2022 09:02:20 +0000 (11:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/OCPPServiceUtils.ts

index 85a62c589d2549e96fd86249cf3fa0e72e80aef0..1699f046da3982353a45ec637d43adce4b91d6d8 100644 (file)
@@ -1315,7 +1315,7 @@ export default class ChargingStation {
 
   private getOcppConfigurationFromFile(): ChargingStationOcppConfiguration | null {
     let configuration: ChargingStationConfiguration = null;
-    if (this.getOcppPersistentConfiguration()) {
+    if (this.getOcppPersistentConfiguration() === true) {
       const configurationFromFile = this.getConfigurationFromFile();
       configuration = configurationFromFile?.configurationKey && configurationFromFile;
     }
@@ -1361,7 +1361,7 @@ export default class ChargingStation {
         );
       }
       if (this.isRegistered() === true) {
-        if (this.isInAcceptedState()) {
+        if (this.isInAcceptedState() === true) {
           await this.startMessageSequence();
         }
       } else {
index 163828d5fdffdce59810c6a2c67d8e78fc106ba8..ad78d347b965ddef05d06777388461cce61e6a2c 100644 (file)
@@ -88,10 +88,10 @@ export class OCPPServiceUtils {
     }
     if (
       measurand !== MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER &&
-      !ChargingStationConfigurationUtils.getConfigurationKey(
+      ChargingStationConfigurationUtils.getConfigurationKey(
         chargingStation,
         StandardParametersKey.MeterValuesSampledData
-      )?.value.includes(measurand)
+      )?.value.includes(measurand) === false
     ) {
       logger.debug(
         `${chargingStation.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${onPhaseStr}in template on connectorId ${connectorId} not found in '${
@@ -104,7 +104,7 @@ export class OCPPServiceUtils {
       chargingStation.getConnectorStatus(connectorId).MeterValues;
     for (
       let index = 0;
-      !Utils.isEmptyArray(sampledValueTemplates) && index < sampledValueTemplates.length;
+      Utils.isEmptyArray(sampledValueTemplates) === false && index < sampledValueTemplates.length;
       index++
     ) {
       if (