<commit_before>// Prevent jshinf from raising the "Expected an assignment or function call and instead saw an expression" warning
// jshint -W030

+function ($) {
    'use strict';

  // FILTERABLE CLASS DEFINITION
  // ======================
  var Filterable = function ($filterable) {
    this.$filterable = $filterable;
  };

  Filterable.prototype.filter = function (fObjects) {
    $(document).trigger('filter.sui.filterable', [this.$filterable]);
    this.$filterable.show();
    this.$filterable.each(function(dataIndex, dataEl) {
      for (var i1 = 0; i1 < fObjects.length; i1++) {
        var fObj = fObjects[i1];
        var dataElAttribVal = $(dataEl).data(fObj['filter-attrib']);
        if ($.type(dataElAttribVal) !== 'undefined') {
          var hideEl = false;

          if (fObj['filter-operator'] == 'subset') {
            for (var i2 = 0; i2 < fObj['filter-value'].length; i2++) {
              if (dataElAttribVal.indexOf(fObj['filter-value'][i2]) === -1) {
                hideEl = true;
                break;
              }
            }
          }

          else if (fObj['filter-operator'] == 'intersect') {
            hideEl = true;
            if (typeof(fObj['filter-value']) === 'string') {
              fObj['filter-value'] = [fObj['filter-value']];
            }
            if (typeof(dataElAttribVal) === 'string') {
              dataElAttribVal = [dataElAttribVal];
            }
            for (var i3 = 0; i3 < fObj['filter-value'].length; i3++) {
              for (var i4 = 0; i4 < dataElAttribVal.length; i4++) {
                if (dataElAttribVal[i4].indexOf(fObj['filter-value'][i3]) !== -1) {
                  hideEl = false;
                  break;
                }
              }
            }
          }

          else if (
            (fObj['filter-operator'] === '=' && +dataElAttribVal !== +fObj['filter-value']) ||
            (fObj['filter-operator'] === '>=' && +dataElAttribVal < +fObj['filter-value']) ||
            (fObj['filter-operator'] === '<=' && +dataElAttribVal > +fObj['filter-value']) ||
            (fObj['filter-operator'] === '<' && +dataElAttribVal >= +fObj['filter-value']) ||
            (fObj['filter-operator'] === '>' && +dataElAttribVal <= +fObj['filter-value'])
          ) {
            hideEl = true;
          }

          if (hideEl === true) {
            $(dataEl).hide();
          }
        }
      }
    });
    $(document).trigger('filtered.sui.filterable', [this.$filterable]);
  };
<commit_msg>if there are no filter objects passed nothing happens (as opposed to throwing error)<commit_after>// Prevent jshinf from raising the "Expected an assignment or function call and instead saw an expression" warning
// jshint -W030

+function ($) {
    'use strict';

  // FILTERABLE CLASS DEFINITION
  // ======================
  var Filterable = function ($filterable) {
    this.$filterable = $filterable;
  };

  Filterable.prototype.filter = function (fObjects) {
    $(document).trigger('filter.sui.filterable', [this.$filterable]);
    if (fObjects && fObjects.length) {
      this.$filterable.show();
      this.$filterable.each(function(dataIndex, dataEl) {
        for (var i1 = 0; i1 < fObjects.length; i1++) {
          var fObj = fObjects[i1];
          var dataElAttribVal = $(dataEl).data(fObj['filter-attrib']);
          if ($.type(dataElAttribVal) !== 'undefined') {
            var hideEl = false;

            if (fObj['filter-operator'] == 'subset') {
              for (var i2 = 0; i2 < fObj['filter-value'].length; i2++) {
                if (dataElAttribVal.indexOf(fObj['filter-value'][i2]) === -1) {
                  hideEl = true;
                  break;
                }
              }
            }

            else if (fObj['filter-operator'] == 'intersect') {
              hideEl = true;
              if (typeof(fObj['filter-value']) === 'string') {
                fObj['filter-value'] = [fObj['filter-value']];
              }
              if (typeof(dataElAttribVal) === 'string') {
                dataElAttribVal = [dataElAttribVal];
              }
              for (var i3 = 0; i3 < fObj['filter-value'].length; i3++) {
                for (var i4 = 0; i4 < dataElAttribVal.length; i4++) {
                  if (dataElAttribVal[i4].indexOf(fObj['filter-value'][i3]) !== -1) {
                    hideEl = false;
                    break;
                  }
                }
              }
            }

            else if (
              (fObj['filter-operator'] === '=' && +dataElAttribVal !== +fObj['filter-value']) ||
              (fObj['filter-operator'] === '>=' && +dataElAttribVal < +fObj['filter-value']) ||
              (fObj['filter-operator'] === '<=' && +dataElAttribVal > +fObj['filter-value']) ||
              (fObj['filter-operator'] === '<' && +dataElAttribVal >= +fObj['filter-value']) ||
              (fObj['filter-operator'] === '>' && +dataElAttribVal <= +fObj['filter-value'])
            ) {
              hideEl = true;
            }

            if (hideEl === true) {
              $(dataEl).hide();
            }
          }
        }
      });
    }
    $(document).trigger('filtered.sui.filterable', [this.$filterable]);
  };

{'fraction_non_alphanumeric': 0.1803688052247407, 'fraction_numerical': 0.009604302727621975, 'mean_word_length': 1.8562808557323094, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, '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': '4783348', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1544, 'n_words': 288}