Skip to content

Commit

Permalink
♻️ use for i loop
Browse files Browse the repository at this point in the history
  • Loading branch information
astoilkov committed Dec 27, 2023
1 parent 86a1368 commit 21e0b57
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/inspect/inspectors/inspectObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ function multiLineObject(
options: Required<ConsoleInspectOptions>,
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(": "));
Expand Down

0 comments on commit 21e0b57

Please sign in to comment.