@empathyco/x-components
Version:
Empathy X Components
19 lines (17 loc) • 746 B
JavaScript
/**
* Default implementation for the {@link PopularSearchesGetters.popularSearches} getter.
*
* @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the
* popular searches module.
* @returns The popular searches, filtered by the searched queries or not, depending of the
* `hideSessionQueries` config.
* @public
*/
const popularSearches = ({ popularSearches, searchedQueries, config, }) => {
const queriesToFilter = searchedQueries.map((historyQuery) => historyQuery.query);
return config.hideSessionQueries
? popularSearches.filter(({ query }) => !queriesToFilter.includes(query))
: popularSearches;
};
export { popularSearches };
//# sourceMappingURL=popular-searches.getter.js.map