function enumeratePaths(
  { rawValue, isGrandTotal, children, isValueColumn },
  path = [],
) {
  if (isGrandTotal) {
    return [[]];
  }
  if (isValueColumn) {
    return [path];
  }
  const pathWithValue = [...path, rawValue];
  return children.length === 0
    ? [pathWithValue]
    : children.flatMap(child => enumeratePaths(child, pathWithValue));
}
// Given a tree representation of an index, enumeratePaths produces a list of all paths to leaf nodes
Given a tree representation of an index, enumeratePaths produces a list of all paths to leaf nodes
Given a tree representation of an index enumeratePaths produces a list of all paths to leaf nodes
function enumeratePaths(
  { rawValue, isGrandTotal, children, isValueColumn },
  path = [],
) {
  if (isGrandTotal) {
    return [[]];
  }
  if (isValueColumn) {
    return [path];
  }
  const pathWithValue = [...path, rawValue];
  return children.length === 0
    ? [pathWithValue]
    : children.flatMap(child => enumeratePaths(child, pathWithValue));
}
function enumeratePaths ( { rawValue , isGrandTotal , children , isValueColumn } , path = [ ] , ) { if ( isGrandTotal ) { return [ [ ] ] ; } if ( isValueColumn ) { return [ path ] ; } const pathWithValue = [ ... path , rawValue ] ; return children . length === 0 ? [ pathWithValue ] : children . flatMap ( child => enumeratePaths ( child , pathWithValue ) ) ; }
Given a tree representation of an index, enumeratePaths produces a list of all paths to leaf nodes
Given a tree representation of an index enumeratePaths produces a list of all paths to leaf nodes