<commit_before>function Order (fee, tax, tip, isTipPercentage) {
  var subtotal = 0;
  var costs = {};
  var fee, tax, tip, isTipPercentage, feesPerPerson, taxPercent, tipPercent, total, subtotal, totals;

  function setDefaults () {
    if (!fee) {
      console.warn('Fee unset; defaulting to 0');
      fee = 0;
    }

    if (!tax) {
      console.warn('Tax unset; defaulting to 0');
      tax = 0;
    }

    if (!tip) {
      console.warn('Tip unset; defaulting to 0');
      tip = 0;
    }
  }

  var order = {
    addItem: function (name, cost) {
      if (costs[name] == null) {
        costs[name] = 0;
      }

      costs[name] += cost;
      subtotal += cost;
    },

    set fee (x) {
      fee = x;
    },

    set tax (x) {
      tax = x;
    },

    set tip (x) {
      tip = x;
    },

    set isTipPercentage (x) {
      isTipPercentage = x;
    },

    split: function () {
      setDefaults();

      if (isTipPercentage) {
        tipPercent = tip / 100;
        tip = tipPercent * subtotal;
      } else {
        tipPercent = tip / subtotal;
      }

      taxPercent = tax / subtotal;
      feesPerPerson = fee / Object.keys(costs).length;
      total = subtotal + tax + fee + tip;

      totals = {};
      for (var person in costs) {
        totals[person] =
            costs[person] + // cost of items
            costs[person] * taxPercent + // tax on items
            costs[person] * tipPercent + // tip on items
            feesPerPerson;
      }
    },

    get costs () {
      return costs;
    },

    get fee () {
      return fee;
    },

    get feesPerPerson () {
      return feesPerPerson;
    },

    get tax () {
      return tax;
    },

    get taxPercent () {
      return taxPercent * 100;
    },<commit_msg>Reorganize setters<commit_after>function Order (fee, tax, tip, isTipPercentage) {
  var subtotal = 0;
  var costs = {};
  var fee, tax, tip, isTipPercentage, feesPerPerson, taxPercent, tipPercent, total, subtotal, totals;

  function setDefaults () {
    if (!fee) {
      console.warn('Fee unset; defaulting to 0');
      fee = 0;
    }

    if (!tax) {
      console.warn('Tax unset; defaulting to 0');
      tax = 0;
    }

    if (!tip) {
      console.warn('Tip unset; defaulting to 0');
      tip = 0;
    }
  }

  var order = {
    addItem: function (name, cost) {
      if (costs[name] == null) {
        costs[name] = 0;
      }

      costs[name] += cost;
      subtotal += cost;
    },

    split: function () {
      setDefaults();

      if (isTipPercentage) {
        tipPercent = tip / 100;
        tip = tipPercent * subtotal;
      } else {
        tipPercent = tip / subtotal;
      }

      taxPercent = tax / subtotal;
      feesPerPerson = fee / Object.keys(costs).length;
      total = subtotal + tax + fee + tip;

      totals = {};
      for (var person in costs) {
        totals[person] =
            costs[person] + // cost of items
            costs[person] * taxPercent + // tax on items
            costs[person] * tipPercent + // tip on items
            feesPerPerson;
      }
    },

    set fee (x) {
      fee = x;
    },

    set tax (x) {
      tax = x;
    },

    set tip (x) {
      tip = x;
    },

    set isTipPercentage (x) {
      isTipPercentage = x;
    },

    get costs () {
      return costs;
    },

    get fee () {
      return fee;
    },

    get feesPerPerson () {
      return feesPerPerson;
    },

    get tax () {
      return tax;
    },

    get taxPercent () {
      return taxPercent * 100;
    },
{'fraction_non_alphanumeric': 0.12901392441034384, 'fraction_numerical': 0.007956805910770106, 'mean_word_length': 1.6586102719033233, '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': '7504849', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1140, 'n_words': 311}