<commit_before>var Rule = require('peasy-js').Rule;

var CanShipOrderItemRule = Rule.extend({
  params: ['orderItem'],
  functions: {
    _onValidate: function(done) {
      if (this.orderItem.status !== "SUBMITTED" && this.orderItem.status !== "BACKORDERED") {
        this._invalidate(`Order item ${this.orderItem.id} is not in a shippable state`);
      }
      done();
    }
  }
});
<commit_msg>refactor canShipOrderItemRule<commit_after>var Rule = require('peasy-js').Rule;

var CanShipOrderItemRule = Rule.extend({
  params: ['orderItem'],
  functions: {
    _onValidate: function(done) {
      var validStatuses = ["SUBMITTED", "BACKORDERED"];
      if (validStatuses.indexOf(this.orderItem.status) === -1) {
        this._invalidate(`Order item ${this.orderItem.id} is not in a shippable state`);
      }
      done();
    }
  }
});

{'fraction_non_alphanumeric': 0.15933412604042807, 'fraction_numerical': 0.0011890606420927466, 'mean_word_length': 3.5026737967914436, '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': '7239332', 'n_tokens_mistral': 278, 'n_tokens_neox': 282, 'n_words': 55}