// eslint-disable-next-line import/prefer-default-export
export const isSearchPath = (allMarkets, pagePath) => {
  if (!allMarkets) {
    return false;
  }

  const marketKeys = Object.keys(allMarkets);

  return (
    pagePath === 's' ||
    marketKeys.some((marketKey) => {
      const market = allMarkets[marketKey];
      return market.path_prefix && pagePath === `${market.path_prefix}/s`;
    })
  );
};
