docs: function setRefs(allPages, pages) {
              if (!pages) {
                  pages = allPages;
              }
  
              for (var index = 0; index < pages.length; index++) {
                  var stateRef;
  
                  if (pages[index].stateRef) {
                      stateRef = stateRefSearch(allPages, pages[index].stateRef);
  
                      if (null !== stateRef) {
                          pages[index] = merge({}, stateRef, pages[index]);
                      }
                  }
  
                  if (pages[index].pages) {
                      pages[index].pages = setRefs(allPages, pages[index].pages);
                  }
              }
  
              return pages;
          }