queckezz / fmt-obj

Stringifies any javascript object in your console for CLI inspection :sparkles:
MIT License
444 stars 16 forks source link

Better Circular Reference Displays #3

Closed jordonbiondo closed 7 years ago

jordonbiondo commented 7 years ago

Objects with circular references display (collapsed) on these references rather than displaying a representation of the circular relationship.

Consider using a library like ciruclar-json or something else to handle these cases.

Consider the following output below:

Using fmt-obj on an object with a circular reference: Note that object.b.z points back to the root object, and object.d points to .b.c.e


    a: 3
    b: 
       x: 10
       z: (collapsed)
       c: (collapsed)
    d: 
       foo: "bar"

Using prettyjson and circular-json together on the same object:

a: 3
b: 
  x: 10
  z: ~
  c: 
    e: 
      foo: bar
d: ~b~c~e
queckezz commented 7 years ago

Added in 1.3.0 :sparkles: :