<commit_before>var d3 = require('d3');
var moment = require('moment');

var _getExtents = function(series) {
  var extents = [];

  function _getSeriesExtents(timeseries) {
    return d3.extent(timeseries.data, (datum) => {
      if (datum) {
        return moment(datum.timestamp).isValid() ?
          datum.timestamp : undefined;
      }
    });
  }

  for (var ii = 0, nn = series.length; ii < nn; ii++) {
    extents = extents.concat(_getSeriesExtents(series[ii]));
  }
  return d3.extent(extents);
};

module.exports = function(series) {
  if (!series || !series.length) {
    return [];
  }

  var extents = _getExtents(series);
  if (!extents[0] || !extents[1]) {
    return [];
  }

  return [extents[0], extents[1]];
};<commit_msg>time domain updated to use es6 arrow functions<commit_after>var d3 = require('d3');
var moment = require('moment');

var _getExtents = (series) => {
  var extents = [];

  var _getSeriesExtents = timeseries => {
    return d3.extent(timeseries.data, datum => {
      if (datum) {
        return moment(datum.timestamp).isValid() ?
          datum.timestamp : undefined;
      }
    });
  }

  series.forEach(datum => {
    extents = extents.concat(_getSeriesExtents(datum));
  });

  return d3.extent(extents);
};

module.exports = series => {
  if (!series || !series.length) {
    return [];
  }

  var extents = _getExtents(series);
  if (!extents[0] || !extents[1]) {
    return [];
  }

  return [extents[0], extents[1]];
};
{'fraction_non_alphanumeric': 0.16870748299319727, 'fraction_numerical': 0.012244897959183673, 'mean_word_length': 3.178977272727273, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3190393', 'n_tokens_mistral': 520, 'n_tokens_neox': 509, 'n_words': 102}