ssbc / ssb-meta-feeds

10 stars 0 forks source link

add getTree and printTree APIs #102

Closed staltz closed 1 year ago

staltz commented 1 year ago

Context

For fun. I also thought that printTree could be very useful in the future when debugging.

Solution

printTree() will put this kind of ASCII diagram in the console:

root
└─┬ v1
  ├─┬ 2
  │ └── main
  └─┬ f
    └── chess

getTree() will return an object that has the full hierarchical structure for the tree. This could be a good alternative to branchStream for some downstream modules.

The new dependency has a tiny footprint.