From: Jérôme Benoit Date: Sat, 9 Dec 2023 19:49:49 +0000 (+0100) Subject: refactor: use RegExp.exec() X-Git-Tag: v1.2.30~31 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9e026a6a48b3be9ec4b36d70285f6d27be70cbb6;p=e-mobility-charging-stations-simulator.git refactor: use RegExp.exec() Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 4b387bc7..d6ca6874 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -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] = (