@@ -6,12 +6,12 @@ import {
6
6
ConsoleInspectOptions ,
7
7
} from "../consoleInspect" ;
8
8
import { type ConsoleObject , consoleObject } from "../../core/consoleObject" ;
9
- import spansLength from "../../utils/spansLength" ;
10
9
import indent from "../../utils/indent" ;
11
10
import isPrimitive from "../../utils/isPrimitive" ;
12
11
import ConsoleInspection from "../utils/ConsoleInspection" ;
13
12
import inspectInline from "./inspectInline" ;
14
13
import { inspectObject } from "./inspectObject" ;
14
+ import spansLength from "../../utils/spansLength" ;
15
15
16
16
export function inspectIterable (
17
17
iterable : Iterable < unknown > ,
@@ -34,16 +34,22 @@ export function inspectIterable(
34
34
}
35
35
36
36
// wrap is "auto", try to fit on one line
37
- const inspection = inspectIterableSingleLine ( iterable , options , context ) ;
37
+
38
38
const array = iterableArray ( iterable ) ;
39
39
if (
40
- spansLength ( inspection . spans ) <= context . wrap &&
41
40
array . every ( isPrimitive ) &&
42
41
iterableExtraKeys ( iterable ) . every ( ( key ) =>
43
42
isPrimitive ( array [ key as keyof typeof array ] ) ,
44
43
)
45
44
) {
46
- return inspection ;
45
+ const inspection = inspectIterableSingleLine (
46
+ iterable ,
47
+ options ,
48
+ context ,
49
+ ) ;
50
+ if ( spansLength ( inspection . spans ) <= context . wrap ) {
51
+ return inspection ;
52
+ }
47
53
}
48
54
49
55
return inspectIterableMultiLine ( iterable , options , context ) ;
0 commit comments