<commit_before>'use babel'

export default class StatusBarItem {
  constructor () {
    this.element = document.createElement('a')
    this.element.className = 'line-ending-tile inline-block'
    this.setLineEndings(new Set())
  }

  setLineEndings (lineEndings) {
    this.lineEndings = lineEndings
    this.element.textContent = lineEndingName(lineEndings)
  }

  hasLineEnding (lineEnding) {
    return this.lineEndings.has(lineEnding)
  }

  description () {
    return lineEndingDescription(this.lineEndings)
  }

  onClick (callback) {
    this.element.addEventListener('click', callback)
  }
}

function lineEndingName (lineEndings) {
  if (lineEndings.size > 1) {
    return 'Mixed'
  } else if (lineEndings.has('\n')) {
    return 'LF'
  } else if (lineEndings.has('\r\n')) {
    return 'CRLF'
  } else if (lineEndings.has('\r')) {
    return 'CR'
  } else {
    return ''
  }
}

function lineEndingDescription (lineEndings) {
  const convert = {
    Mixed: 'mixed',
    LF: 'LF (Unix)',
    CRLF: 'CRLF (Windows)',
    CR: 'CR (old Macintosh)'
  }

  return convert[lineEndingName(lineEndings) || 'unknown']
}<commit_msg>use "Classic MacOS" instead of "old Macintosh"<commit_after>'use babel'

export default class StatusBarItem {
  constructor () {
    this.element = document.createElement('a')
    this.element.className = 'line-ending-tile inline-block'
    this.setLineEndings(new Set())
  }

  setLineEndings (lineEndings) {
    this.lineEndings = lineEndings
    this.element.textContent = lineEndingName(lineEndings)
  }

  hasLineEnding (lineEnding) {
    return this.lineEndings.has(lineEnding)
  }

  description () {
    return lineEndingDescription(this.lineEndings)
  }

  onClick (callback) {
    this.element.addEventListener('click', callback)
  }
}

function lineEndingName (lineEndings) {
  if (lineEndings.size > 1) {
    return 'Mixed'
  } else if (lineEndings.has('\n')) {
    return 'LF'
  } else if (lineEndings.has('\r\n')) {
    return 'CRLF'
  } else if (lineEndings.has('\r')) {
    return 'CR'
  } else {
    return ''
  }
}

function lineEndingDescription (lineEndings) {
  const convert = {
    Mixed: 'mixed',
    LF: 'LF (Unix)',
    CRLF: 'CRLF (Windows)',
    CR: 'CR (Classic MacOS)'
  }

  return convert[lineEndingName(lineEndings) || 'unknown']
}
{'fraction_non_alphanumeric': 0.13856209150326798, 'fraction_numerical': 0.0008714596949891067, 'mean_word_length': 3.5108055009823183, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7211432', 'n_tokens_mistral': 815, 'n_tokens_neox': 795, 'n_words': 158}