<commit_before>import _ from 'lodash/fp';

class Conjunction {
  constructor(mappings) {
    this.mappings = mappings;
  }

  createEqualInputChecker(inputObj) {
    return mappingKey => {
      const mappingValue = _.get(mappingKey, this.mappings);
      const inputValue = _.get(mappingKey, inputObj);

      // Nested conjunction
      if (_.isObject(mappingValue) &&
          Conjunction.shouldConvertToConjunction(mappingValue)) {
        return create(mappingValue).satisfied(inputValue);
      }

      return inputValue === mappingValue;
    };
  }

  static shouldConvertToConjunction(obj) {
    return !Conjunction.isConjunction(obj) &&
      _.isObject(obj) &&
      _.has('type', obj) &&
      _.has('mappings', obj);
  }

  static isConjunction(obj) {
    return obj instanceof Conjunction;
  }
}

class And extends Conjunction {
  constructor(mappings) {
    super(mappings);
    this.type = 'and';
  }<commit_msg>If mappingValue is an instance of conjunction then use satisfied method<commit_after>import _ from 'lodash/fp';

class Conjunction {
  constructor(mappings) {
    this.mappings = mappings;
  }

  createEqualInputChecker(inputObj) {
    return mappingKey => {
      const mappingValue = _.get(mappingKey, this.mappings);
      const inputValue = _.get(mappingKey, inputObj);

      // Nested conjunction
      if (Conjunction.isConjunction(mappingValue)) {
        return mappingValue.satisfied(inputValue);
      } else if (Conjunction.shouldConvertToConjunction(mappingValue)) {
        return create(mappingValue).satisfied(inputValue);
      } else {
        return inputValue === mappingValue;
      }
    };
  }

  static shouldConvertToConjunction(obj) {
    return !Conjunction.isConjunction(obj) &&
      _.isObject(obj) &&
      _.has('type', obj) &&
      _.has('mappings', obj);
  }

  static isConjunction(obj) {
    return obj instanceof Conjunction;
  }
}

class And extends Conjunction {
  constructor(mappings) {
    super(mappings);
    this.type = 'and';
  }
{'fraction_non_alphanumeric': 0.11371571072319202, 'fraction_numerical': 0.0, 'mean_word_length': 3.223157894736842, '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': '5267396', 'n_tokens_mistral': 623, 'n_tokens_neox': 584, 'n_words': 119}