From: Jérôme Benoit Date: Tue, 15 Nov 2022 19:17:38 +0000 (+0100) Subject: Small integer parsing optimization X-Git-Tag: v1.1.88~30 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=231d1ecd25f002a28380985f53726d9c8bdd2106;p=e-mobility-charging-stations-simulator.git Small integer parsing optimization Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 4542e6ef..6b7f709f 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -194,7 +194,8 @@ export class OCPPServiceUtils { ): number { options.limitationEnabled = options?.limitationEnabled ?? true; options.unitMultiplier = options?.unitMultiplier ?? 1; - const numberValue = isNaN(parseInt(value)) ? Infinity : parseInt(value); + const parsedInt = parseInt(value); + const numberValue = isNaN(parsedInt) ? Infinity : parsedInt; return options?.limitationEnabled ? Math.min(numberValue * options.unitMultiplier, limit) : numberValue * options.unitMultiplier;