From: Jérôme Benoit Date: Tue, 14 Feb 2023 15:33:26 +0000 (+0100) Subject: refactor(simulator): use helper(s) where appropriate X-Git-Tag: v1.1.95~58 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4c5e87ae4e007b3cb0a8636515da8c3fe2bccff3;p=e-mobility-charging-stations-simulator.git refactor(simulator): use helper(s) where appropriate Signed-off-by: Jérôme Benoit --- diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index a2c77719..44340cc4 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -49,7 +49,7 @@ export class JsonFileStorage extends Storage { public open(): void { try { - if (this?.fd === undefined || this?.fd === null) { + if (Utils.isNullOrUndefined(this?.fd)) { this.fd = fs.openSync(this.dbName, 'a+'); } } catch (error) { diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index bffa0a17..8a66d92d 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -185,7 +185,7 @@ export class Utils { return clone(object); } - public static objectHasOwnProperty(object: object, property: string): boolean { + public static objectHasOwnProperty(object: unknown, property: string): boolean { return ( Utils.isObject(object) && (Object.prototype.hasOwnProperty.call(object, property) as boolean) );