Skip to content

Commit

Permalink
Remove underscore compose usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rique223 committed Sep 11, 2023
1 parent fadc452 commit c004275
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/meteor/client/views/marketplace/hooks/useFilteredApps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { PaginatedResult } from '@rocket.chat/rest-typings';
import type { ContextType } from 'react';
import { useMemo } from 'react';
import { compose } from 'underscore';

import type { AppsContext } from '../../../contexts/AppsContext';
import type { AsyncState } from '../../../lib/asyncState';
Expand Down Expand Up @@ -85,7 +84,13 @@ export const useFilteredApps = ({
requested: (apps: App[]) => apps.filter(({ appRequestStats, installed }) => Boolean(appRequestStats) && !installed),
};

const filtered = compose(
type appsFilterFunction = (apps: App[]) => App[];
const composeAppsFilters =
(...functions: appsFilterFunction[]) =>
(initialValue: App[]) =>
functions.reduce((currentAppsList, currentFilterFunction) => currentFilterFunction(currentAppsList), initialValue);

const filtered = composeAppsFilters(
context ? filterByContext[context] : fallback,
filterByPurchaseType[purchaseType],
filterByStatus[status],
Expand Down

0 comments on commit c004275

Please sign in to comment.