docs: function tree(app, options) {
    var opts = extend({}, options);
    var node = {
      label: getLabel(app, opts),
      metadata: getMetadata(app, opts)
    };
  
    // get the names of the children to lookup
    var names = arrayify(opts.names || ['nodes']);
    return names.reduce(function(acc, name) {
      var children = app[name];
      if (typeof children !== 'object') {
        return node;
      }
  
      // build a tree for each child node
      var nodes = [];
      for (var key in children) {
        var child = children[key];
        if (typeof child[opts.method] === 'function') {
          nodes.push(child[opts.method](opts));
        } else {
          var res = tree(child, opts);
          nodes.push(res);
        }
      }
  
      if (nodes.length) {
        node.nodes = (node.nodes || []).concat(nodes);
      }
      return node;
    }, node);
  
  
  }