handlebars/helpers/dirTree.js
function condense (node) {
  if (node.nodes.length === 1 && node.nodes[0].nodes.length > 0) {
    return condense({
      label: (node.label || '') + node.nodes[0].label,
      nodes: node.nodes[0].nodes
    })
  } else {
    return {
      label: node.label,
      nodes: node.nodes.map(condense)
    }
  }
}
function condense (node) {
  if (node.nodes.length === 1 && node.nodes[0].nodes.length > 0) {
    return condense({
      label: (node.label || '') + node.nodes[0].label,
      nodes: node.nodes[0].nodes
    })
  } else {
    return {
      label: node.label,
      nodes: node.nodes.map(condense)
    }
  }
}
function condense ( node ) { if ( node . nodes . length === 1 && node . nodes [ 0 ] . nodes . length > 0 ) { return condense ( { label : ( node . label || '' ) + node . nodes [ 0 ] . label , nodes : node . nodes [ 0 ] . nodes } ) } else { return { label : node . label , nodes : node . nodes . map ( condense ) } } }
Merge an archy-node with its single child, but not with a leaf node.
Keep nodes with zero, two or more childs.
@access private
Merge an archy - node with its single child but not with a leaf node . Keep nodes with zero two or more childs .