<commit_before>import { createSelector } from 'reselect';
import { getColorByIndex, createLegendBuckets } from 'utils/map';
import uniqBy from 'lodash/uniqBy';
import sortBy from 'lodash/sortBy';
import worldPaths from 'app/data/world-50m-paths';
import { europeSlug, europeanCountries } from 'app/data/european-countries';
import { PATH_LAYERS } from 'app/data/constants';

const getCountries = state => state.countries || null;
const getCategoriesData = state => state.categories || {};
const getIndicatorsData = state => state.mapIndicators || [];

export const getISOCountries = createSelector([getCountries], countries =>
  countries.map(country => country.iso_code3)
);

export const getCategories = createSelector(getCategoriesData, categories =>
  sortBy(
    Object.keys(categories).map(category => ({
      label: categories[category].name,
      value: categories[category].slug,
      id: category
    })),
    'label'
  )
);

export const getIndicatorsParsed = createSelector(
  [getIndicatorsData, getISOCountries],<commit_msg>Use mapCategories on map selectors<commit_after>import { createSelector } from 'reselect';
import { getColorByIndex, createLegendBuckets } from 'utils/map';
import uniqBy from 'lodash/uniqBy';
import sortBy from 'lodash/sortBy';
import worldPaths from 'app/data/world-50m-paths';
import { europeSlug, europeanCountries } from 'app/data/european-countries';
import { PATH_LAYERS } from 'app/data/constants';

const getCountries = state => state.countries || null;
const getCategoriesData = state => state.mapCategories || {};
const getIndicatorsData = state => state.mapIndicators || [];

export const getISOCountries = createSelector([getCountries], countries =>
  countries.map(country => country.iso_code3)
);

export const getCategories = createSelector(getCategoriesData, categories =>
  sortBy(
    Object.keys(categories).map(category => ({
      label: categories[category].name,
      value: categories[category].slug,
      id: category
    })),
    'label'
  )
);

export const getIndicatorsParsed = createSelector(
  [getIndicatorsData, getISOCountries],
{'fraction_non_alphanumeric': 0.12060778727445394, 'fraction_numerical': 0.002849002849002849, 'mean_word_length': 5.365558912386707, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3227613', 'n_tokens_mistral': 634, 'n_tokens_neox': 627, 'n_words': 143}