code: function pathToTree(path, numStemmed) {
    var root;
    var leaf;
    for (var i = numStemmed, len = path.length; i < len; i++) {
      var node = path[i];
      var currentLeaf = [node.id, node.opts, []];
      if (leaf) {
        leaf[2].push(currentLeaf);
        leaf = currentLeaf;
      } else {
        root = leaf = currentLeaf;
      }
    }
    return root;
  }
docs: Turn a path as a flat array into a tree with a single branch. If any should be stemmed from the beginning of the array, that's passed in as the second argument