text: function max(x) {
    if (x.length === 0) {
      throw new Error('max requires at least one data point');
    }
  
    var value = x[0];
  
    for (var i = 1; i < x.length; i++) {
      if (x[i] > value) {
        value = x[i];
      }
    }
  
    return value * 1;
  }
  
  function min(x) {
    if (x.length === 0) {
      throw new Error('min requires at least one data point');
    }
  
    var value = x[0];
  
    for (var i = 1; i < x.length; i++) {
      if (x[i] < value) {
        value = x[i];
      }
    }
  
    return value * 1;
  }
  
  function sum(x) {
    if (x.length === 0) {
      return 0;
    }
  
    var sumNum = x[0] * 1;
  
    for (var i = 1; i < x.length; i++) {
      sumNum += x[i] * 1;
    }
  
    return sumNum;
  }
  
  function mean(x) {
    if (x.length === 0) {
      throw new Error('mean requires at least one data point');
    }
  
    return sum(x) / x.length;
  }
  
  function mode(x) {
    if (x.length === 0) {
      throw new Error('mean requires at least one data point');
    }
  
    if (x.length < 3) {
      return x[0];
    }
  
    x.sort();
    var last = x[0];
    var value = NaN;
    var maxSeen = 0;
    var seenThis = 1;
  
    for (var i = 1; i < x.length + 1; i++) {
      if (x[i] !== last) {
        if (seenThis > maxSeen) {
          maxSeen = seenThis;
          value = last;
        }
  
        seenThis = 1;
        last = x[i];
      } else {
        seenThis++;
      }
    }
  
    return value * 1;
  }
  
  export { sum, max, min, mean, mode };
  export var statMap = {
    min: min,
    max: max,
    mean: mean,
    sum: sum,
    mode: mode
  };
  export function getColumn(data, columnName) {
    return data.map(function (item) {
      return item[columnName];
    });
  }
  export function getSatByColumn(type, column) {
    return statMap[type](column);
  }
  //# sourceMappingURL=statistics.js.map