<commit_before>import Baby from 'babyparse'

class nicknames {

  // Returns the array from line from names.csv where first value == name.
  static retreiveRow(rows, name) {
    let result = null
    name = name.toLowerCase()

    let matched_row = rows.find(row => row[0] === name)

    if (matched_row)
      result = matched_row

    return result
  }

  // returns array from lines from names.csv where any value == name.
  static retreiveRows(rows, name) {
    let result = null
    name = name.toLowerCase()

    let matched_rows = [].concat(...rows.filter(row => {
      return !!row.find(item => item === name)
    }))

    if (matched_rows)
      result = matched_rows

    return result
  }

  // get() will return all related nicksnames.
  static get(name) {
    let result = null

    if (name) {
      name = name.toLowerCase()
      let rows = Baby.parseFiles('./names.csv').data

      result = Nicknames.retreiveRows(rows, name)
    }

    return result
  }

  // Will be passed two strings,
  // and determine if they match via
  // related nicknames.
  // returns true or false.
  static match(name1, name2) {
    let result = null

    if (name1 && name2) {
      name1 = name1.toLowerCase()
      name2 = name2.toLowerCase()

      if (name1 === name2)
        return true

      // Cross reference, get all of name1s related names, see if name2 is included,
      // then get all of name2s related names, see if name1 is included.
      let result1 = !!Nicknames.get(name1).find(name => name === name2)
      let result2 = !!Nicknames.get(name2).find(name => name === name1)
      result = (result1 || result2)
    }

    return result
  }

}

module.exports = Nicknames<commit_msg>Lowercased class name.<commit_after>import Baby from 'babyparse'

class nicknames {

  // Returns the array from line from names.csv where first value == name.
  static retreiveRow(rows, name) {
    let result = null
    name = name.toLowerCase()

    let matched_row = rows.find(row => row[0] === name)

    if (matched_row)
      result = matched_row

    return result
  }

  // returns array from lines from names.csv where any value == name.
  static retreiveRows(rows, name) {
    let result = null
    name = name.toLowerCase()

    let matched_rows = [].concat(...rows.filter(row => {
      return !!row.find(item => item === name)
    }))

    if (matched_rows)
      result = matched_rows

    return result
  }

  // get() will return all related nicksnames.
  static get(name) {
    let result = null

    if (name) {
      name = name.toLowerCase()
      let rows = Baby.parseFiles('./names.csv').data

      result = nicknames.retreiveRows(rows, name)
    }

    return result
  }

  // Will be passed two strings,
  // and determine if they match via
  // related nicknames.
  // returns true or false.
  static match(name1, name2) {
    let result = null

    if (name1 && name2) {
      name1 = name1.toLowerCase()
      name2 = name2.toLowerCase()

      if (name1 === name2)
        return true

      // Cross reference, get all of name1s related names, see if name2 is included,
      // then get all of name2s related names, see if name1 is included.
      let result1 = !!nicknames.get(name1).find(name => name === name2)
      let result2 = !!nicknames.get(name2).find(name => name === name1)
      result = (result1 || result2)
    }

    return result
  }

}

module.exports = nicknames
{'fraction_non_alphanumeric': 0.11449487554904832, 'fraction_numerical': 0.013469985358711566, 'mean_word_length': 2.464503042596349, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5570866', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1048, 'n_words': 335}