src/js/wysiwygCommands/tableAlignCol.js
function getSelectionInformation($table, rangeInformation) {
  const columnLength = $table.find('tr').eq(0).find('td,th').length;
  const {
    from,
    to
  } = rangeInformation;
  let startColumnIndex, endColumnIndex, isDivided;

  if (from.row === to.row) {
    startColumnIndex = from.cell;
    endColumnIndex = to.cell;
  } else if (from.row < to.row) {
    if (from.cell <= to.cell) {
      startColumnIndex = 0;
      endColumnIndex = columnLength - 1;
    } else {
      startColumnIndex = from.cell;
      endColumnIndex = to.cell;
      isDivided = true;
    }
  }

  return {
    startColumnIndex,
    endColumnIndex,
    isDivided
  };
}
function getSelectionInformation($table, rangeInformation) {
  const columnLength = $table.find('tr').eq(0).find('td,th').length;
  const {
    from,
    to
  } = rangeInformation;
  let startColumnIndex, endColumnIndex, isDivided;

  if (from.row === to.row) {
    startColumnIndex = from.cell;
    endColumnIndex = to.cell;
  } else if (from.row < to.row) {
    if (from.cell <= to.cell) {
      startColumnIndex = 0;
      endColumnIndex = columnLength - 1;
    } else {
      startColumnIndex = from.cell;
      endColumnIndex = to.cell;
      isDivided = true;
    }
  }

  return {
    startColumnIndex,
    endColumnIndex,
    isDivided
  };
}
function getSelectionInformation ( $table , rangeInformation ) { const columnLength = $table . find ( 'tr' ) . eq ( 0 ) . find ( 'td,th' ) . length ; const { from , to } = rangeInformation ; let startColumnIndex , endColumnIndex , isDivided ; if ( from . row === to . row ) { startColumnIndex = from . cell ; endColumnIndex = to . cell ; } else if ( from . row < to . row ) { if ( from . cell <= to . cell ) { startColumnIndex = 0 ; endColumnIndex = columnLength - 1 ; } else { startColumnIndex = from . cell ; endColumnIndex = to . cell ; isDivided = true ; } } return { startColumnIndex , endColumnIndex , isDivided } ; }
Return start, end column index and boolean value for whether range divided or not
@param {jQuery} $table jQuery wrapped TABLE
@param {{startColumnIndex: number, endColumnIndex: number}} rangeInformation Range information
@returns {{startColumnIndex: number, endColumnIndex: number, isDivided: boolean}}
Return start end column index and boolean value for whether range divided or not