From: Jérôme Benoit Date: Thu, 7 Sep 2023 00:01:56 +0000 (+0200) Subject: perf: convert deepClone() to arrow function X-Git-Tag: v1.2.21~20 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=015f34040633618656bfbad648f7303c0b883e2d;p=e-mobility-charging-stations-simulator.git perf: convert deepClone() to arrow function Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index c29f8d15..14a6aa69 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -216,11 +216,11 @@ type CloneableData = type FormatKey = (key: string) => string; -function deepClone( +const deepClone = ( value: I, formatKey?: FormatKey, refs: Map = new Map(), -): O { +): O => { const ref = refs.get(value); if (ref !== undefined) { return ref; @@ -249,7 +249,7 @@ function deepClone( ); } return clone as O; -} +}; export const cloneObject = (object: T): T => { return deepClone(object as CloneableData) as T;