<commit_before>const { ASSET, LIABILITY, EQUITY, REVENUE, EXPENSE } = require('./major-account-type')

/**
 * The account type chart model.
 */
class AccountTypeChart {
  constructor () {
    this.names = {}
    this.names[ASSET.name] = []
    this.names[LIABILITY.name] = []
    this.names[EQUITY.name] = []
    this.names[REVENUE.name] = []
    this.names[EXPENSE.name] = []

    this.majorTypes = {}
  }

  /**
   * Adds the account type name by the major account type.
   *
   * @param {string} name The name of the account type
   * @param {MajorAccountType} majorType The major account type
   */
  addNameByMajorType (name, majorType) {
    this.names[majorType.name].push(name)
    this.majorTypes[name] = majorType
  }

  /**
   * Gets the major type by the account type name.
   *
   * @param {string} name The name of account type
   * @return {MajorAccountType}
   * @throws {Error} when the account type name is not found in the chart
   */
  getMajorTypeByAccountTypeName (name) {
    if (typeof name !== 'string') {
      throw Error(`The account type name must be a string: typeof name is ${typeof name}`)
    }

    const majorType = this.majorTypes[name]

    if (majorType == null) {
      throw Error(`The account type name is not found in the chart: ${name}`)
    }

    return majorType
  }<commit_msg>refactor(moneybit-domain): remove dead code<commit_after>const { ASSET, LIABILITY, EQUITY, REVENUE, EXPENSE } = require('./major-account-type')

/**
 * The account type chart model.
 */
class AccountTypeChart {
  constructor () {
    this.majorTypes = {}
  }

  /**
   * Adds the account type name by the major account type.
   *
   * @param {string} name The name of the account type
   * @param {MajorAccountType} majorType The major account type
   */
  addNameByMajorType (name, majorType) {
    this.majorTypes[name] = majorType
  }

  /**
   * Gets the major type by the account type name.
   *
   * @param {string} name The name of account type
   * @return {MajorAccountType}
   * @throws {Error} when the account type name is not found in the chart
   */
  getMajorTypeByAccountTypeName (name) {
    if (typeof name !== 'string') {
      throw Error(`The account type name must be a string: typeof name is ${typeof name}`)
    }

    const majorType = this.majorTypes[name]

    if (majorType == null) {
      throw Error(`The account type name is not found in the chart: ${name}`)
    }

    return majorType
  }
{'fraction_non_alphanumeric': 0.1169255928045789, 'fraction_numerical': 0.0, 'mean_word_length': 3.0049099836333877, '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': '4661142', 'n_tokens_mistral': 769, 'n_tokens_neox': 744, 'n_words': 248}