code: function makeGroups(scope, nodes) {
      var children = parse.children;
      var groupBy = parse.groupBy;
      var groups = {};
      var group;
      var node;
  
      for (var i = 0, len = nodes.length; i < len; i++) {
        node = nodes[i];
        group = node[groupBy];
  
        if (!groups[group]) {
          groups[group] = {};
          groups[group][children] = [node];
          groups[group][groupBy] = group;
        }
        else {
          groups[group][children].push(node);
        }
      }
  
      groups = Object.keys(groups)
      .map(function(group) { return groups[group]; });
  
      for (i = 0, len = groups.length; i < len; i++) {
        group = groups[i];
  
        if (scope.nodes.some(pushTo(group))) continue;
  
        scope.nodes.push(group);
      }
    }
docs: add groups to `scope`, extracted from `nodes` using the parsed `this.expression`.  pushes nodes to groups, rather than simply reassigning, so as to prevent destruction of tree branches and the associated loss of state. If the scope's nodes array is simply replaced, all the branches will be destroyed and re-drawn, causing them to revert to a default state (i.e. collapsed).