refactor: silence sonar
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 10 May 2023 22:53:46 +0000 (00:53 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 10 May 2023 22:53:46 +0000 (00:53 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/utils/Utils.ts

index cfb6efeacfd99700e14d99004d718ac02f3f5409..b1785a13c528c0587e8676e658b7b23752f8ce3f 100644 (file)
@@ -486,9 +486,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     );
     if (!keyToChange) {
       return OCPP16Constants.OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED;
-    } else if (keyToChange && keyToChange.readonly) {
+    } else if (keyToChange?.readonly === true) {
       return OCPP16Constants.OCPP_CONFIGURATION_RESPONSE_REJECTED;
-    } else if (keyToChange && !keyToChange.readonly) {
+    } else if (keyToChange?.readonly === false) {
       let valueChanged = false;
       if (keyToChange.value !== commandPayload.value) {
         ChargingStationConfigurationUtils.setConfigurationKeyValue(
index 37f7691198771bdb7832bad6553afa7bac6a7138..2724f03f4c3aca4b4a0ad2994082ba51f5609726 100644 (file)
@@ -222,11 +222,11 @@ export class Utils {
     return value == null;
   }
 
-  public static isEmptyArray(object: unknown | unknown[]): boolean {
+  public static isEmptyArray(object: unknown): boolean {
     return Array.isArray(object) && object.length === 0;
   }
 
-  public static isNotEmptyArray(object: unknown | unknown[]): boolean {
+  public static isNotEmptyArray(object: unknown): boolean {
     return Array.isArray(object) && object.length > 0;
   }