import { HistoryQuery } from '@empathyco/x-types' ; import { GettersClass } from '../../../../store/getters.types' ; import { normalizeString } from '../../../../utils/normalize' ; import { HistoryQueriesState , HistoryQueriesXStoreModule } from '../types' ; /**
 * Class implementation for the  HistoryQueriesGetters . historyQueries getter.
 *
 *  public export class HistoryQueriesGetter implements GettersClass < HistoryQueriesXStoreModule > { /**
     * Default implementation for the  HistoryQueriesGetters . historyQueries getter.
     *
     *  param state - Current  https of the history
     * queries module.
     *  returns historyQueries ( { query , historyQueries , config } ) { return query ? historyQueries . filter ( this . searchInHistoryQueries ( normalizeString ( query ) , config . hideIfEqualsQuery ) ) : historyQueries ; } param normalizedQuery param hideIfEqualsQuery returns internal protected searchInHistoryQueries ( normalizedQuery , hideIfEqualsQuery ) { return ( historyQuery ) => { const normalizedHistoryQuery = normalizeString ( historyQuery . query ) ; const matchesQuery = normalizedHistoryQuery . includes ( normalizedQuery ) ; return hideIfEqualsQuery ? matchesQuery && normalizedHistoryQuery !== normalizedQuery : matchesQuery ; } ; } } const historyQueriesGetter = new HistoryQueriesGetter ( ) ; public export const historyQueries = historyQueriesGetter . historyQueries . bind ( historyQueriesGetter ) ;