selectors.ts 468 B

123456789101112
  1. import { PluginsState } from 'app/types/plugins';
  2. export const getPlugins = (state: PluginsState) => {
  3. const regex = new RegExp(state.searchQuery, 'i');
  4. return state.plugins.filter(item => {
  5. return regex.test(item.name) || regex.test(item.info.author.name) || regex.test(item.info.description);
  6. });
  7. };
  8. export const getPluginsSearchQuery = (state: PluginsState) => state.searchQuery;
  9. export const getLayoutMode = (state: PluginsState) => state.layoutMode;