code: function traverseRecursiveSync(rootNode, options) {
    options = extend({
      subnodesAccessor: function(node) { return node.subnodes; },
      onNode: function(node, userdata) {},
      userdata: null
    }, options);
  
    (function visitNode(node) {
      var subnodes = options.subnodesAccessor(node);
      for (var i=0; i<subnodes.length; i++) {
        visitNode(subnodes[i]);
      }
      options.onNode(node, options.userdata);
    })(rootNode);
  
    return rootNode;
  }
docs: Synchronously traverses the tree recursively.