refactor(simulator): use helper(s) where appropriate
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 14 Feb 2023 15:33:26 +0000 (16:33 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 14 Feb 2023 15:33:26 +0000 (16:33 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/performance/storage/JsonFileStorage.ts
src/utils/Utils.ts

index a2c77719622b2491fb7f5c41d6639c82ee037dd3..44340cc4e425a9b1faf5f520a9f69e344f8fab77 100644 (file)
@@ -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) {
index bffa0a17982fb7b9364cee51ad6cadeb84f096da..8a66d92d2cde25db89f225c0d6e0742adee45ae7 100644 (file)
@@ -185,7 +185,7 @@ export class Utils {
     return clone<T>(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)
     );