<commit_before>var TYPES = {
  PLAIN: 'Plain',
  CARTODB: 'CartoDB',
  TILED: 'Tiled',
  TORQUE: 'torque',
  GMAPSBASE: 'GMapsBase',
  WMS: 'WMS'
};

// Migrated from old models (models/map.js, cdb.admin.Layers)
var KIND_TO_TYPE_MAP = {
  'background': TYPES.PLAIN,
  'carto': TYPES.CARTODB,
  'gmapsbase': TYPES.GMAPSBASE,
  'tiled': TYPES.TILED,
  'torque': TYPES.TORQUE,
  'wms': TYPES.WMS,
  'Layer::Tiled': TYPES.TILED,
  'Layer::Carto': TYPES.CARTODB,
  'Layer::Background': TYPES.PLAIN
};

module.exports = {

  getType: function (kind) {
    var type = KIND_TO_TYPE_MAP[kind];

    if (!type) {
      throw new Error('no type found for given kind ' + kind);
    }

    return type;
  },

  getKind: function (type) {
    if (!type) {
      throw new Error('no kind found for given type ' + type);
    }

    var kind;
    for (kind in KIND_TO_TYPE_MAP) {
      if (KIND_TO_TYPE_MAP[kind] === type) {
        break;
      }
    }

    return kind;
  },

  isCartoDBType: function (type) {
    return type === TYPES.CARTODB;
  },

  isTorqueType: function (type) {
    return type === TYPES.TORQUE;
  },

  isTiledType: function (type) {
    return type === TYPES.TILED;
  }
};<commit_msg>Use variables instead of object for constants<commit_after>// Types
var PLAIN = 'Plain';
var CARTODB = 'CartoDB';
var TILED = 'Tiled';
var TORQUE = 'torque';
var GMAPSBASE = 'GMapsBase';
var WMS = 'WMS';

// Migrated from old models (models/map.js, cdb.admin.Layers)
var KIND_TO_TYPE_MAP = {
  'background': PLAIN,
  'carto': CARTODB,
  'gmapsbase': GMAPSBASE,
  'tiled': TILED,
  'torque': TORQUE,
  'wms': WMS,
  'Layer::Tiled': TILED,
  'Layer::Carto': CARTODB,
  'Layer::Background': PLAIN
};

module.exports = {

  getType: function (kind) {
    var type = KIND_TO_TYPE_MAP[kind];

    if (!type) {
      throw new Error('no type found for given kind ' + kind);
    }

    return type;
  },

  getKind: function (type) {
    if (!type) {
      throw new Error('no kind found for given type ' + type);
    }

    var kind;
    for (kind in KIND_TO_TYPE_MAP) {
      if (KIND_TO_TYPE_MAP[kind] === type) {
        break;
      }
    }

    return kind;
  },

  isCartoDBType: function (type) {
    return type === CARTODB;
  },

  isTorqueType: function (type) {
    return type === TORQUE;
  },

  isTiledType: function (type) {
    return type === TILED;
  }
};
{'fraction_non_alphanumeric': 0.15120711562897077, 'fraction_numerical': 0.0, 'mean_word_length': 2.9235880398671097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '935823', 'n_tokens_mistral': 940, 'n_tokens_neox': 929, 'n_words': 220}