Skip to content

Update helpers.ts - #2

Open
iskandarreza wants to merge 1 commit into
nitaiaharoni1:masterfrom
iskandarreza:text-filter-criteria-improvement
Open

Update helpers.ts#2
iskandarreza wants to merge 1 commit into
nitaiaharoni1:masterfrom
iskandarreza:text-filter-criteria-improvement

Conversation

@iskandarreza

Copy link
Copy Markdown

The current matchesCriteria method for criteria.text does not seem very effective.

  if (criteria.text) {
    const texts = Array.isArray(criteria.text) ? criteria.text : [criteria.text];
    if (!texts.includes(document.text)) {
      return false;
    }
  }

This means if criteria.text (or elements in an array passed in as it's value) is not an exact match to document.text, we'll get no results.

Unless that is by design, I propose the following minor change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant