<commit_before>import { createSelector } from 'reselect';
import { selectArticles } from './articles';
import { selectEvents } from './events';

export const selectFrontpage = createSelector(
  selectArticles,
  selectEvents,
  (articles, events) => {
    return articles.concat(events);
  }
);
<commit_msg>Sort events and articles by dates from now<commit_after>import moment from 'moment';
import { sortBy } from 'lodash';
import { createSelector } from 'reselect';
import { selectArticles } from './articles';
import { selectEvents } from './events';

export const selectFrontpage = createSelector(
  selectArticles,
  selectEvents,
  (articles, events) =>
    sortBy(articles.concat(events), item => {
      const timeField = item.eventType ? item.startTime : item.createdAt;
      return Math.abs(moment() - moment(timeField));
    })
);

{'fraction_non_alphanumeric': 0.1257413997627521, 'fraction_numerical': 0.0, 'mean_word_length': 4.552631578947368, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '1173303', 'n_tokens_mistral': 242, 'n_tokens_neox': 235, 'n_words': 67}