refactor: use RegExp.exec()
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 9 Dec 2023 19:49:49 +0000 (20:49 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 9 Dec 2023 19:49:49 +0000 (20:49 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 4b387bc7b182bcd82390aced1a68d2b422d0fe50..d6ca68745cddfdf075aea10fbaa6b5df057c417f 100644 (file)
@@ -1199,8 +1199,8 @@ export class ChargingStation extends EventEmitter {
       const patternGroup: number | undefined =
         this.stationInfo.firmwareUpgrade?.versionUpgrade?.patternGroup ??
         this.stationInfo.firmwareVersion?.split('.').length;
-      const match = this.stationInfo
-        .firmwareVersion!.match(new RegExp(this.stationInfo.firmwareVersionPattern!))!
+      const match = new RegExp(this.stationInfo.firmwareVersionPattern!)
+        .exec(this.stationInfo.firmwareVersion!)!
         .slice(1, patternGroup! + 1);
       const patchLevelIndex = match.length - 1;
       match[patchLevelIndex] = (