src/api/v4/dataview/time-series/parse-data.js
function parseTimeSeriesData (data, nulls, totalAmount, offset) {
  if (!data) {
    return null;
  }
  var compactData = _.compact(data);
  var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
  var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
    ? maxBin.freq
    : null;

  /**
   * @description
   * Object containing time series data.
   *
   * @typedef {object} carto.dataview.TimeSeriesData
   * @property {number} nulls - The number of items with null value
   * @property {number} totalAmount - The number of elements returned
   * @property {number} offset - The time offset in hours. Needed to format UTC timestamps into the proper timezone format
   * @property {carto.dataview.TimeSeriesBinItem[]} bins - Array containing the {@link carto.dataview.TimeSeriesBinItem|data bins} for the time series
   * @api
   */
  return {
    bins: _createBins(compactData, maxFreq),
    nulls: nulls || 0,
    offset: secondsToHours(offset),
    totalAmount: totalAmount
  };
}
function parseTimeSeriesData (data, nulls, totalAmount, offset) {
  if (!data) {
    return null;
  }
  var compactData = _.compact(data);
  var maxBin = _.max(compactData, function (bin) { return bin.freq || 0; });
  var maxFreq = _.isFinite(maxBin.freq) && maxBin.freq !== 0
    ? maxBin.freq
    : null;

  /**
   * @description
   * Object containing time series data.
   *
   * @typedef {object} carto.dataview.TimeSeriesData
   * @property {number} nulls - The number of items with null value
   * @property {number} totalAmount - The number of elements returned
   * @property {number} offset - The time offset in hours. Needed to format UTC timestamps into the proper timezone format
   * @property {carto.dataview.TimeSeriesBinItem[]} bins - Array containing the {@link carto.dataview.TimeSeriesBinItem|data bins} for the time series
   * @api
   */
  return {
    bins: _createBins(compactData, maxFreq),
    nulls: nulls || 0,
    offset: secondsToHours(offset),
    totalAmount: totalAmount
  };
}
function parseTimeSeriesData ( data , nulls , totalAmount , offset ) { if ( ! data ) { return null ; } var compactData = _ . compact ( data ) ; var maxBin = _ . max ( compactData , function ( bin ) { return bin . freq || 0 ; } ) ; var maxFreq = _ . isFinite ( maxBin . freq ) && maxBin . freq !== 0 ? maxBin . freq : null ; /**
   * @description
   * Object containing time series data.
   *
   * @typedef {object} carto.dataview.TimeSeriesData
   * @property {number} nulls - The number of items with null value
   * @property {number} totalAmount - The number of elements returned
   * @property {number} offset - The time offset in hours. Needed to format UTC timestamps into the proper timezone format
   * @property {carto.dataview.TimeSeriesBinItem[]} bins - Array containing the {@link carto.dataview.TimeSeriesBinItem|data bins} for the time series
   * @api
   */ return { bins : _createBins ( compactData , maxFreq ) , nulls : nulls || 0 , offset : secondsToHours ( offset ) , totalAmount : totalAmount } ; }
Transform the data obtained from an internal timeseries dataview into a  public object.

@param {object[]} data - The raw time series data
@param {number} nulls - Number of data with a null
@param {number} totalAmount - Total number of data in the histogram

@return {TimeSeriesData} - The parsed and formatted data for the given parameters
Transform the data obtained from an internal timeseries dataview into a public object .