lib/Summarizers.js
function meanSummarizer(column, tableData, columns) {
  var stats = tableData.reduce(function (stats, rowData, rowNumber) {
    var sortValue = Utils.getSortValue(column, rowData, rowNumber, tableData, columns);

    if (sortValue) {
      if (stats.sum === null) {
        stats.sum = sortValue;
      } else {
        stats.sum += sortValue;
      }
    }

    return stats;
  }, { sum: null, count: tableData.length, mean: null });

  if (stats.sum !== null) {
    stats.mean = stats.sum / stats.count;
  }

  return stats;
}
function meanSummarizer(column, tableData, columns) {
  var stats = tableData.reduce(function (stats, rowData, rowNumber) {
    var sortValue = Utils.getSortValue(column, rowData, rowNumber, tableData, columns);

    if (sortValue) {
      if (stats.sum === null) {
        stats.sum = sortValue;
      } else {
        stats.sum += sortValue;
      }
    }

    return stats;
  }, { sum: null, count: tableData.length, mean: null });

  if (stats.sum !== null) {
    stats.mean = stats.sum / stats.count;
  }

  return stats;
}
function meanSummarizer ( column , tableData , columns ) { var stats = tableData . reduce ( function ( stats , rowData , rowNumber ) { var sortValue = Utils . getSortValue ( column , rowData , rowNumber , tableData , columns ) ; if ( sortValue ) { if ( stats . sum === null ) { stats . sum = sortValue ; } else { stats . sum += sortValue ; } } return stats ; } , { sum : null , count : tableData . length , mean : null } ) ; if ( stats . sum !== null ) { stats . mean = stats . sum / stats . count ; } return stats ; }
Computes the mean, sum, and count in a column as `mean, sum, count`.
Does the computation based on the sortValue.

@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 mean of values as `{ mean, sum, count }`
Computes the mean sum and count in a column as mean sum count . Does the computation based on the sortValue .