Skip to content

Commit d76007f

Browse files
Fix indent formatting in nested objects (#1857)
* fix missing indentation in nested objects * review comments
1 parent 19106c2 commit d76007f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/shared/services/utils.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,11 @@ export const stringifyMod = (
313313
const nextPrettyLevel = prettyLevel ? prettyLevel + 1 : false
314314
const newLine = prettyLevel ? '\n' : ''
315315
const indentation =
316-
prettyLevel && !skipOpeningIndentation ? Array(prettyLevel).join(' ') : ''
317-
const nextIndentation =
318-
nextPrettyLevel && !skipOpeningIndentation
319-
? Array(nextPrettyLevel).join(' ')
320-
: ''
321-
const endIndentation = prettyLevel ? Array(prettyLevel).join(' ') : ''
316+
prettyLevel && !skipOpeningIndentation ? ' '.repeat(prettyLevel - 1) : ''
317+
const nextIndentation = nextPrettyLevel
318+
? ' '.repeat(nextPrettyLevel - 1)
319+
: ''
320+
const endIndentation = prettyLevel ? ' '.repeat(prettyLevel - 1) : ''
322321
const propSpacing = prettyLevel ? ' ' : ''
323322
const toString = Object.prototype.toString
324323
const isArray =

0 commit comments

Comments
 (0)