Add runtime persitence on OCPP parameters.
[e-mobility-charging-stations-simulator.git] / src / utils / Utils.js
index 85b2d4748d91c52daab0dfbcff866f63fdedbbac..e85090d49626156d4e2fdb913781762448bdcc8a 100644 (file)
@@ -100,6 +100,22 @@ class Utils {
     return changedID;
   }
 
+  static convertToBoolean(value) {
+    let result = false;
+    // Check boolean
+    if (value) {
+      // Check the type
+      if (typeof value === 'boolean') {
+        // Already a boolean
+        result = value;
+      } else {
+        // Convert
+        result = (value === 'true');
+      }
+    }
+    return result;
+  }
+
   static getRandomInt(max, min) {
     if (min) {
       return Math.floor((Math.random() * (max - min)) + min);