From 21e0b570b7eb27214f29d99cbac3fe972b692a56 Mon Sep 17 00:00:00 2001 From: Antonio Stoilkov Date: Wed, 27 Dec 2023 14:06:02 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20use=20for=20i=20loop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/inspect/inspectors/inspectObject.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/inspect/inspectors/inspectObject.ts b/src/inspect/inspectors/inspectObject.ts index ccc7b40..35d1098 100644 --- a/src/inspect/inspectors/inspectObject.ts +++ b/src/inspect/inspectors/inspectObject.ts @@ -62,16 +62,16 @@ function multiLineObject( options: Required, context: ConsoleInspectContext, ): ConsoleItem[] { - const maxLength = maxKeyLength(object); const messages: ConsoleItem[] = []; + const sortedKeys = sortKeys(object); + const maxLength = maxKeyLength(object); - let isFirst = true; - for (const key of sortKeys(object)) { - if (!isFirst) { + for (let i = 0; i < sortedKeys.length; i++) { + if (i !== 0) { messages.push(consoleText("\n")); } - isFirst = false; + const key = sortedKeys[i]!; messages.push(...createIndent(context, options)); messages.push(consoleText(key, consoleStyles.collapsedObjectKey)); messages.push(consoleText(": "));