File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 283
283
*/
284
284
var recurse = references ?
285
285
function ( value , stringify ) {
286
- var exists = encountered . indexOf ( value ) ;
287
-
288
- // Track nodes to restore later.
289
- if ( exists > - 1 ) {
290
- restore . push ( path . slice ( ) , paths [ exists ] ) ;
291
- return ;
286
+ if ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {
287
+ var exists = encountered . indexOf ( value ) ;
288
+
289
+ // Track nodes to restore later.
290
+ if ( exists > - 1 ) {
291
+ restore . push ( path . slice ( ) , paths [ exists ] ) ;
292
+ return ;
293
+ }
294
+
295
+ // Track encountered nodes.
296
+ encountered . push ( value ) ;
297
+ paths . push ( path . slice ( ) ) ;
292
298
}
293
299
294
300
// Stop when we hit the max depth.
295
301
if ( path . length > maxDepth ) {
296
302
return ;
297
303
}
298
304
299
- // Track encountered nodes.
300
- encountered . push ( value ) ;
301
- paths . push ( path . slice ( ) ) ;
302
-
303
305
// Stringify the value and fallback to
304
306
return stringify ( value , space , next ) ;
305
307
} :
You can’t perform that action at this time.
0 commit comments