<commit_before>
/**
 * Helper functions for parsing and testing node versions.
 * Just plain `parseFloat` doesn't work in case there's ever a "x.10" release,
 * which would be parsed as x.1 when represented as a Number.
 */

var regexp = /^(\d+)\.(\d+)/

/**
 * Accepts a String like "v0.10.4" and returns a String
 * containing the major and minor versions ("0.10").
 */

exports.parse = function parse (str) {
  str = String(str)
  if (str[0] === 'v') {
    str = str.substring(1)
  }
  return str.match(regexp)[0]
}

/**
 * Accepts a major-minor version string (from `parseVersion`) and a major
 * and minor Number value to test that the given version is less that the
 * specified version. Returns true or false.
 */

exports.lessThan = function lessThan (ver, major, minor) {
  var exec = regexp.exec(ver)
    , inMaj = parseInt(exec[1])
    , inMin = parseInt(exec[2])
  if (inMaj > major) return false
  return inMin < minor
}
<commit_msg>Guard against a possible bad version.<commit_after>
/**
 * Helper functions for parsing and testing node versions.
 * Just plain `parseFloat` doesn't work in case there's ever a "x.10" release,
 * which would be parsed as x.1 when represented as a Number.
 */

var regexp = /^(\d+)\.(\d+)/

/**
 * Accepts a String like "v0.10.4" and returns a String
 * containing the major and minor versions ("0.10").
 */

exports.parse = function parse (str) {
  str = String(str)
  if (str[0] === 'v') {
    str = str.substring(1)
  }
  var m = str.match(regexp)
  return m ? m[0] : null
}

/**
 * Accepts a major-minor version string (from `parseVersion`) and a major
 * and minor Number value to test that the given version is less that the
 * specified version. Returns true or false.
 */

exports.lessThan = function lessThan (ver, major, minor) {
  var exec = regexp.exec(ver)
    , inMaj = parseInt(exec[1])
    , inMin = parseInt(exec[2])
  if (inMaj > major) return false
  return inMin < minor
}

{'fraction_non_alphanumeric': 0.13099535843218155, 'fraction_numerical': 0.015471892728210418, 'mean_word_length': 3.282560706401766, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '779473', 'n_tokens_mistral': 641, 'n_tokens_neox': 630, 'n_words': 240}