Treelify converts a Javascript array into a tree structure or a tree structure into a Javascript array.