X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fperformance%2Fstorage%2FJsonFileStorage.ts;h=2cdab50560fda0cd5e744d8265c4f1f49edeef61;hb=5aefc345de84b04a0bd5529830948da4d5c2f547;hp=d1c294d8185e2d4526b2eeeec3e29f31f0f21220;hpb=6c1761d470507ea23d186be61b94ca7375c5144a;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index d1c294d8..2cdab505 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -7,6 +7,7 @@ import lockfile from 'proper-lockfile'; import { FileType } from '../../types/FileType'; import type Statistics from '../../types/Statistics'; import FileUtils from '../../utils/FileUtils'; +import Utils from '../../utils/Utils'; import { Storage } from './Storage'; export class JsonFileStorage extends Storage { @@ -30,19 +31,7 @@ export class JsonFileStorage extends Storage { performanceRecords.push(performanceStatistics); fs.writeFileSync( this.dbName, - JSON.stringify( - performanceRecords, - (key, value) => { - if (value instanceof Map) { - return { - dataType: 'Map', - value: [...value], - }; - } - return value as Statistics; - }, - 2 - ), + Utils.JSONStringifyWithMapSupport(performanceRecords, 2), 'utf8' ); } catch (error) {