From 7c3f41f1608df20b347ff1f659ba83065a5f9891 Mon Sep 17 00:00:00 2001 From: Archangel Date: Sun, 12 Jan 2025 18:28:56 +0100 Subject: [PATCH] Allow FileSystem's writeJson spacing to have more options --- project/src/utils/FileSystem.ts | 6 +++--- project/src/utils/FileSystemSync.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/project/src/utils/FileSystem.ts b/project/src/utils/FileSystem.ts index a4535d08..5f7c9859 100644 --- a/project/src/utils/FileSystem.ts +++ b/project/src/utils/FileSystem.ts @@ -167,11 +167,11 @@ export class FileSystem { * * @param file The file path to write to. * @param jsonObject The object to write to the file. - * @param indentationSpaces The number of spaces to use for indentation. + * @param spacing The number of spaces or string used for spacing of the JSON file. * @returns A promise that resolves when the write operation is complete. */ - public async writeJson(file: string, jsonObject: object, indentationSpaces?: 4): Promise { - const jsonString = JSON.stringify(jsonObject, null, indentationSpaces); + public async writeJson(file: string, jsonObject: object, spacing: string | number = 4): Promise { + const jsonString = JSON.stringify(jsonObject, null, spacing); return this.write(file, jsonString); } diff --git a/project/src/utils/FileSystemSync.ts b/project/src/utils/FileSystemSync.ts index 7193d6e1..e559fa98 100644 --- a/project/src/utils/FileSystemSync.ts +++ b/project/src/utils/FileSystemSync.ts @@ -165,11 +165,11 @@ export class FileSystemSync { * * @param file The file path to write to. * @param jsonObject The object to write to the file. - * @param indentationSpaces The number of spaces to use for indentation. + * @param spacing The number of spaces or string used for spacing of the JSON file. * @returns void */ - public writeJson(file: string, jsonObject: object, indentationSpaces?: 4): void { - const jsonString = JSON.stringify(jsonObject, null, indentationSpaces); + public writeJson(file: string, jsonObject: object, spacing: string | number = 4): void { + const jsonString = JSON.stringify(jsonObject, null, spacing); this.write(file, jsonString); }