lib/modules/apostrophe-pages/lib/routes.js
function clean(nodes) {
        mark(nodes, []);
        return prune(nodes);
        function mark(nodes, ancestors) {
          _.each(nodes, function(node) {
            if (node.publish) {
              node.good = true;
              _.each(ancestors, function(ancestor) {
                ancestor.good = true;
              });
            }
            mark(node.children || [], ancestors.concat([ node ]));
          });
        }
        function prune(nodes) {
          var newNodes = [];
          _.each(nodes, function(node) {
            node.children = prune(node.children || []);
            if (node.good) {
              newNodes.push(node);
            }
          });
          return newNodes;
        }
      }
function clean(nodes) {
        mark(nodes, []);
        return prune(nodes);
        function mark(nodes, ancestors) {
          _.each(nodes, function(node) {
            if (node.publish) {
              node.good = true;
              _.each(ancestors, function(ancestor) {
                ancestor.good = true;
              });
            }
            mark(node.children || [], ancestors.concat([ node ]));
          });
        }
        function prune(nodes) {
          var newNodes = [];
          _.each(nodes, function(node) {
            node.children = prune(node.children || []);
            if (node.good) {
              newNodes.push(node);
            }
          });
          return newNodes;
        }
      }
function clean ( nodes ) { mark ( nodes , [ ] ) ; return prune ( nodes ) ; function mark ( nodes , ancestors ) { _ . each ( nodes , function ( node ) { if ( node . publish ) { node . good = true ; _ . each ( ancestors , function ( ancestor ) { ancestor . good = true ; } ) ; } mark ( node . children || [ ] , ancestors . concat ( [ node ] ) ) ; } ) ; } function prune ( nodes ) { var newNodes = [ ] ; _ . each ( nodes , function ( node ) { node . children = prune ( node . children || [ ] ) ; if ( node . good ) { newNodes . push ( node ) ; } } ) ; return newNodes ; } }
If I can't publish at least one of a node's descendants, prune it from the tree. Returns a pruned version of the tree
If I can t publish at least one of a node s descendants prune it from the tree . Returns a pruned version of the tree