lib/Summarizers.js
function frequencySummarizer(column, tableData, columns) {
  var mostFrequent = void 0;

  var counts = tableData.reduce(function (counts, rowData, rowNumber) {
    var cellData = Utils.getCellData(column, rowData, rowNumber, tableData, columns);
    if (!counts[cellData]) {
      counts[cellData] = 1;
    } else {
      counts[cellData] += 1;
    }

    if (mostFrequent == null || counts[cellData] > counts[mostFrequent]) {
      mostFrequent = cellData;
    }

    return counts;
  }, {});

  return { counts: counts, mostFrequent: mostFrequent };
}
function frequencySummarizer(column, tableData, columns) {
  var mostFrequent = void 0;

  var counts = tableData.reduce(function (counts, rowData, rowNumber) {
    var cellData = Utils.getCellData(column, rowData, rowNumber, tableData, columns);
    if (!counts[cellData]) {
      counts[cellData] = 1;
    } else {
      counts[cellData] += 1;
    }

    if (mostFrequent == null || counts[cellData] > counts[mostFrequent]) {
      mostFrequent = cellData;
    }

    return counts;
  }, {});

  return { counts: counts, mostFrequent: mostFrequent };
}
function frequencySummarizer ( column , tableData , columns ) { var mostFrequent = void 0 ; var counts = tableData . reduce ( function ( counts , rowData , rowNumber ) { var cellData = Utils . getCellData ( column , rowData , rowNumber , tableData , columns ) ; if ( ! counts [ cellData ] ) { counts [ cellData ] = 1 ; } else { counts [ cellData ] += 1 ; } if ( mostFrequent == null || counts [ cellData ] > counts [ mostFrequent ] ) { mostFrequent = cellData ; } return counts ; } , { } ) ; return { counts : counts , mostFrequent : mostFrequent } ; }
Computes the frequency for each value in the dataset and computes the most frequent.
If there is a tie for most frequent, it returns just the first encountered value.
Does the summary based on the cellData value.

@param {Object} column The column definition
@param {Object[]} tableData the data for the whole table
@param {Object[]} columns The definitions of columns for the whole table

@return {Object} The most frequently occuring value `{ counts, mostFrequent }`
Computes the frequency for each value in the dataset and computes the most frequent . If there is a tie for most frequent it returns just the first encountered value . Does the summary based on the cellData value .