From 1e2ec4a6612809e178b5237bf6302562ba3c0512 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 14 Jan 2024 13:42:46 +0100 Subject: [PATCH] refactor: cleanup arguments namespace MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ocpp/OCPPServiceUtils.ts | 12 ++++++------ src/utils/Utils.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 53548065..3e375b82 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -1329,16 +1329,16 @@ export class OCPPServiceUtils { return true } - public static convertDateToISOString(obj: T): void { - for (const key in obj) { + public static convertDateToISOString(object: T): void { + for (const key in object) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion - if (isDate(obj![key])) { + if (isDate(object![key])) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion - (obj![key] as string) = (obj![key] as Date).toISOString() + (object![key] as string) = (object![key] as Date).toISOString() // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-condition - } else if (typeof obj![key] === 'object' && obj![key] !== null) { + } else if (typeof object![key] === 'object' && object![key] !== null) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion - OCPPServiceUtils.convertDateToISOString(obj![key] as T) + OCPPServiceUtils.convertDateToISOString(object![key] as T) } } } diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 458fd930..ae27035f 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -240,7 +240,7 @@ const deepClone = ( return clone as O } if (value instanceof Date) { - return new Date(value.valueOf()) as O + return new Date(value.getTime()) as O } if (typeof value !== 'object' || value === null) { return value as unknown as O -- 2.34.1