Skip to content

Commit

Permalink
consoleInspect() different separator depending if the values pass…
Browse files Browse the repository at this point in the history
…ed where primitive or not
  • Loading branch information
astoilkov committed Jan 13, 2025
1 parent cb16640 commit 57e2c81
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/inspect/consoleInspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ function inspect(
options: Required<ConsoleInspectOptions>,
): ConsoleSpan[] {
const spans: ConsoleSpan[] = [];
const separator = values.every((value) => isPrimitive(value))
? " "
: "\n\n";

for (let i = 0; i < values.length; i++) {
const value = values[i];
Expand Down Expand Up @@ -125,9 +128,7 @@ function inspect(
spans.push(...inspection.spans);

if (i !== values.length - 1) {
spans.push(
consoleText(inspection.type === "block" ? "\n" : " "),
);
spans.push(consoleText(separator));
}
}
}
Expand Down

0 comments on commit 57e2c81

Please sign in to comment.