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 = ({
4949 // path,
5050 subEntries,
5151 subEntryPages,
52+ type,
5253 // depth,
5354 expanded,
5455 toggle,
@@ -62,7 +63,10 @@ const DefaultRenderer = ({
6263 < >
6364 < Label onClick = { ( ) => toggle ( ) } >
6465 < Expander expanded = { expanded } /> { label } { ' ' }
65- < Info > { subEntries . length } items</ Info >
66+ < Info >
67+ { String ( type ) . toLowerCase ( ) === 'iterable' ? '(Iterable) ' : '' }
68+ { subEntries . length } items
69+ </ Info >
6670 </ Label >
6771 { expanded ? (
6872 subEntryPages . length === 1 ? (
@@ -100,7 +104,7 @@ const DefaultRenderer = ({
100104 </ >
101105 ) : (
102106 < >
103- < Label > { label } :</ Label > < Value > { JSON . stringify ( value ) } </ Value >
107+ < Label > { label } :</ Label > < Value > { JSON . stringify ( value , Object . getOwnPropertyNames ( Object ( value ) ) ) } </ Value >
104108 </ >
105109 ) }
106110 </ Entry >
@@ -149,6 +153,18 @@ export default function Explorer({
149153 value : d ,
150154 } )
151155 )
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+ )
152168 } else if ( typeof value === 'object' && value !== null ) {
153169 type = 'object'
154170 subEntries = Object . entries ( value ) . map ( ( [ label , value ] ) =>
You can’t perform that action at this time.
0 commit comments