<commit_before>'use strict';

// Partially implements Headers from the Fetch API
// https://developer.mozilla.org/en-US/docs/Web/API/Headers
function FastBootHeaders(headers) {
  headers = headers || {};
  this.headers = {};

  for (var header in headers) {
    let value = headers[header];

    // Express gives us either a string
    // or an array of strings if there are multiple values.
    // We want to support the Header spec
    // so we will coerce to an array always.
    if (typeof value === 'string') {
      value = [value];
    }

    this.headers[header] = value;
  }
}

FastBootHeaders.prototype.append = function(header, value) {
  header = header.toLowerCase();
  if (!this.has(header)) {
    this.headers[header] = [];
  }

  this.headers[header].push(value);
};

FastBootHeaders.prototype.delete = function(header) {
  delete this.headers[header.toLowerCase()];
};

FastBootHeaders.prototype.entries = function() {
  var entries = [];

  for(var key in this.headers) {
    var values = this.headers[key];
    for(var index = 0; index < values.length; ++index ) {
      entries.push([key, values[index]]);
    }
  }

  return entries[Symbol.iterator]();
};

FastBootHeaders.prototype.get = function(header) {
  return this.getAll(header)[0] || null;
};

FastBootHeaders.prototype.getAll = function(header) {
  return this.headers[header.toLowerCase()] || [];
};

FastBootHeaders.prototype.has = function(header) {
  return this.headers[header.toLowerCase()] !== undefined;
};

FastBootHeaders.prototype.keys = function() {
  var entries = [];

  for(var key in this.headers) {
    var values = this.headers[key];
    for(var index = 0; index < values.length; ++index ) {
      entries.push(key);
    }
  }

  return entries[Symbol.iterator]();
};

FastBootHeaders.prototype.set = function(header, value) {
  header = header.toLowerCase();
  this.headers[header] = [value];
};

FastBootHeaders.prototype.values = function() {
  var entries = [];

  for(var key in this.headers) {
    var values = this.headers[key];
    for(var index = 0; index < values.length; ++index ) {
      entries.push(values[index]);
    }
  }

  return entries[Symbol.iterator]();
};

module.exports = FastBootHeaders;
<commit_msg>convert FastBootHeaders to es6 class<commit_after>'use strict';

// Partially implements Headers from the Fetch API
// https://developer.mozilla.org/en-US/docs/Web/API/Headers
class FastBootHeaders {
  constructor(headers) {
    headers = headers || {};
    this.headers = {};

    for (var header in headers) {
      let value = headers[header];

      // Express gives us either a string
      // or an array of strings if there are multiple values.
      // We want to support the Header spec
      // so we will coerce to an array always.
      if (typeof value === 'string') {
        value = [value];
      }

      this.headers[header] = value;
    }
  }

  append(header, value) {
    let _header = header.toLowerCase();

    if (!this.has(_header)) {
      this.headers[_header] = [];
    }

    this.headers[_header].push(value);
  }

  delete(header) {
    delete this.headers[header.toLowerCase()];
  }

  entries() {
    var entries = [];

    for(var key in this.headers) {
      var values = this.headers[key];
      for(var index = 0; index < values.length; ++index ) {
        entries.push([key, values[index]]);
      }
    }

    return entries[Symbol.iterator]();
  }

  get(header) {
    return this.getAll(header)[0] || null;
  }

  getAll(header) {
    return this.headers[header.toLowerCase()] || [];
  }

  has(header) {
    return this.headers[header.toLowerCase()] !== undefined;
  }

  keys() {
    var entries = [];

    for(var key in this.headers) {
      var values = this.headers[key];
      for(var index = 0; index < values.length; ++index ) {
        entries.push(key);
      }
    }

    return entries[Symbol.iterator]();
  }

  set(header, value) {
    header = header.toLowerCase();
    this.headers[header] = [value];
  }

  values() {
    var entries = [];

    for(var key in this.headers) {
      var values = this.headers[key];
      for(var index = 0; index < values.length; ++index ) {
        entries.push(values[index]);
      }
    }

    return entries[Symbol.iterator]();
  }
}

module.exports = FastBootHeaders;

{'fraction_non_alphanumeric': 0.14868329060824984, 'fraction_numerical': 0.0020974131903985084, 'mean_word_length': 2.9232175502742233, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '7185782', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1325, 'n_words': 315}