import map from 'lodash/map' import format from 'date-fns/format' import type { Match } from 'requests' import { getSportLexic } from 'helpers' const prepareMatch = ({ access, date, has_video, id, preview, sport, stream_status, sub, team1, team2, tournament, }: Match) => ({ accessibleBySubscription: sub, accessibleInUsersCountry: access, date: format(new Date(date), 'dd.MM.yy'), hasVideo: has_video, id, preview, sportName: getSportLexic(sport), sportType: sport, streamStatus: stream_status, team1, team2, time: format(new Date(date), 'HH:mm'), tournament, }) export const prepareMatches = (matches: Array) => map( matches, prepareMatch, )