DeepDive - a debugging tool for deeply nested data structures

Hi! This is my first public elixir library. I hope someone can benefit from it, as I ceased to work with this nice language at the moment.

DeepDive

Where

Github: GitHub - blallo/deep_dive: Debug utility to explore nested data structures in elixir
Hex.pm: deep_dive | Hex
Hexdocs.pm: DeepDive — Deep Dive v1.0.0

What

DeepDive is an extremely simple library to explore a complex and possibly unknown data structures in search of keys that sound. I developed an early stub to explore a deeply nested Absinthe.Resolution struct I needed to get hold of. It treats everything as a map and every map as a tree. It offers two different strategies to explore the tree in search for nodes (the keys) that match some pattern:

  • DeepDive.FirstFound looks for the first match on each branch and returns
  • DeepDive.FullWalk looks for each match on the whole tree

The interface is a single function, find_key/2, that wants the data structure as first argument and a matcher as second argument. A matcher may be:

  • an exact value to match
  • a regex
  • a function of kind (term -> bool)

Peek into the documentation for more info.

How

I used to put an IEx.pry() near the code I needed to examine and, from there, call the function on the data. I suggest to install the library only in the :dev mix environment.

Have fun and use the github issues to signal any problem.

3 Likes