docs: fix README.md formatting
[e-mobility-charging-stations-simulator.git] / src / performance / storage / JsonFileStorage.ts
index 3fe5e58eed7aef75f35ae120e97033bd3cdb02d5..31d18537f783067bebd396d40cf19fad34d69b0f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
+// Copyright Jerome Benoit. 2021-2024. All Rights Reserved.
 
 import { closeSync, existsSync, mkdirSync, openSync, writeSync } from 'node:fs'
 import { dirname } from 'node:path'
@@ -34,7 +34,7 @@ export class JsonFileStorage extends Storage {
         0,
         'utf8'
       )
-    }).catch((error) => {
+    }).catch(error => {
       handleFileException(
         this.dbName,
         FileType.PerformanceRecords,
@@ -47,7 +47,7 @@ export class JsonFileStorage extends Storage {
   public open (): void {
     JsonFileStorage.performanceRecords = new Map<string, Statistics>()
     try {
-      if (this?.fd == null) {
+      if (this.fd == null) {
         if (!existsSync(dirname(this.dbName))) {
           mkdirSync(dirname(this.dbName), { recursive: true })
         }
@@ -66,9 +66,9 @@ export class JsonFileStorage extends Storage {
   public close (): void {
     JsonFileStorage.performanceRecords.clear()
     try {
-      if (this?.fd != null) {
+      if (this.fd != null) {
         closeSync(this.fd)
-        delete this?.fd
+        delete this.fd
       }
     } catch (error) {
       handleFileException(
@@ -81,7 +81,7 @@ export class JsonFileStorage extends Storage {
   }
 
   private checkPerformanceRecordsFile (): void {
-    if (this?.fd == null) {
+    if (this.fd == null) {
       throw new BaseError(
         `${this.logPrefix} Performance records '${this.dbName}' file descriptor not found`
       )