<commit_before>export class LocalFilter {

  protected static FILTER = (value: string, search: string) => {
    return value.includes(search);
  };

  static filter(data: Array<any>, field: string, search: string, customFilter?: Function): Array<any> {
    let filter: Function = customFilter ? customFilter : this.FILTER;

    return data.filter((el) => {
      let value = typeof el[field] === 'undefined' || el[field] === null ? '' : el[field];
      return filter.call(null, value.toString().toLowerCase(), search.toString().toLowerCase());
    });
  }
}<commit_msg>fix(filter): add ability to rewrite filter rules (cherry picked from commit eed3ded)<commit_after>export class LocalFilter {

  protected static FILTER = (value: string, search: string) => {
    return value.toString().toLowerCase().includes(search.toString().toLowerCase());
  };

  static filter(data: Array<any>, field: string, search: string, customFilter?: Function): Array<any> {
    let filter: Function = customFilter ? customFilter : this.FILTER;

    return data.filter((el) => {
      let value = typeof el[field] === 'undefined' || el[field] === null ? '' : el[field];
      return filter.call(null, value, search);
    });
  }
}
{'fraction_non_alphanumeric': 0.15772089182493806, 'fraction_numerical': 0.0008257638315441783, 'mean_word_length': 4.269565217391304, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5626063', 'n_tokens_mistral': 344, 'n_tokens_neox': 340, 'n_words': 95}