dangerfile.js
function generateMDTable(headers, body) {
  const headerRow = headers.map(header => header.label);
  const alignmentRow = headers.map(header => {
    if (header.align === 'right') {
      return ' ---:';
    }
    if (header.align === 'center') {
      return ':---:';
    }
    return ' --- ';
  });

  return [headerRow, alignmentRow, ...body].map(row => row.join(' | ')).join('\n');
}
function generateMDTable(headers, body) {
  const headerRow = headers.map(header => header.label);
  const alignmentRow = headers.map(header => {
    if (header.align === 'right') {
      return ' ---:';
    }
    if (header.align === 'center') {
      return ':---:';
    }
    return ' --- ';
  });

  return [headerRow, alignmentRow, ...body].map(row => row.join(' | ')).join('\n');
}
function generateMDTable ( headers , body ) { const headerRow = headers . map ( header => header . label ) ; const alignmentRow = headers . map ( header => { if ( header . align === 'right' ) { return ' ---:' ; } if ( header . align === 'center' ) { return ':---:' ; } return ' --- ' ; } ) ; return [ headerRow , alignmentRow , ... body ] . map ( row => row . join ( ' | ' ) ) . join ( '\n' ) ; }
Generates a Markdown table
@param {{ label: string, align: 'left' | 'center' | 'right'}[]} headers
@param {string[][]} body
@returns {string}
Generates a Markdown table