Create hierarchy.js

Utility functions for converting back and forth between a sql relational database table with a flattened hierarchical structure and a json tree.