(plugin, filterState)
| 629 | } |
| 630 | |
| 631 | function doesPluginMatchFilter(plugin, filterState) { |
| 632 | if (!plugin) return false; |
| 633 | |
| 634 | switch (filterState.type) { |
| 635 | case "verified": |
| 636 | return Boolean(plugin.author_verified); |
| 637 | case "author": { |
| 638 | const authorName = getPluginAuthorName(plugin); |
| 639 | if (!authorName) return false; |
| 640 | return authorName.toLowerCase().includes(filterState.value); |
| 641 | } |
| 642 | case "keywords": { |
| 643 | const pluginKeywords = getPluginKeywords(plugin) |
| 644 | .map((keyword) => keyword.toLowerCase()) |
| 645 | .filter(Boolean); |
| 646 | if (!pluginKeywords.length) return false; |
| 647 | return filterState.value.some((keyword) => |
| 648 | pluginKeywords.some((pluginKeyword) => pluginKeyword.includes(keyword)), |
| 649 | ); |
| 650 | } |
| 651 | default: |
| 652 | return true; |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | function getPluginAuthorName(plugin) { |
| 657 | const { author } = plugin || {}; |
no test coverage detected