Building a tree structure from a flat array I have an array of objects. Each contains a “lv” property, which is an integer >= 0.