This repository was archived by the owner on Jan 2, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ const DefaultRenderer = ({
49
49
// path,
50
50
subEntries,
51
51
subEntryPages,
52
+ type,
52
53
// depth,
53
54
expanded,
54
55
toggle,
@@ -62,7 +63,10 @@ const DefaultRenderer = ({
62
63
< >
63
64
< Label onClick = { ( ) => toggle ( ) } >
64
65
< Expander expanded = { expanded } /> { label } { ' ' }
65
- < Info > { subEntries . length } items</ Info >
66
+ < Info >
67
+ { String ( type ) . toLowerCase ( ) === 'iterable' ? '(Iterable) ' : '' }
68
+ { subEntries . length } items
69
+ </ Info >
66
70
</ Label >
67
71
{ expanded ? (
68
72
subEntryPages . length === 1 ? (
@@ -100,7 +104,7 @@ const DefaultRenderer = ({
100
104
</ >
101
105
) : (
102
106
< >
103
- < Label > { label } :</ Label > < Value > { JSON . stringify ( value ) } </ Value >
107
+ < Label > { label } :</ Label > < Value > { JSON . stringify ( value , Object . getOwnPropertyNames ( Object ( value ) ) ) } </ Value >
104
108
</ >
105
109
) }
106
110
</ Entry >
@@ -149,6 +153,18 @@ export default function Explorer({
149
153
value : d ,
150
154
} )
151
155
)
156
+ } else if (
157
+ value !== null &&
158
+ typeof value === 'object' &&
159
+ typeof value [ Symbol . iterator ] === 'function'
160
+ ) {
161
+ type = 'Iterable'
162
+ subEntries = Array . from ( value , ( val , i ) =>
163
+ makeProperty ( {
164
+ label : i ,
165
+ value : val ,
166
+ } )
167
+ )
152
168
} else if ( typeof value === 'object' && value !== null ) {
153
169
type = 'object'
154
170
subEntries = Object . entries ( value ) . map ( ( [ label , value ] ) =>
You can’t perform that action at this time.
0 commit comments