Skip to content

Commit

Permalink
Allow FileSystem's writeJson spacing to have more options
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchangelWTF committed Jan 12, 2025
1 parent aeee1b8 commit 7c3f41f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions project/src/utils/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const jsonString = JSON.stringify(jsonObject, null, indentationSpaces);
public async writeJson(file: string, jsonObject: object, spacing: string | number = 4): Promise<void> {
const jsonString = JSON.stringify(jsonObject, null, spacing);
return this.write(file, jsonString);
}

Expand Down
6 changes: 3 additions & 3 deletions project/src/utils/FileSystemSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 7c3f41f

Please sign in to comment.