You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
708 B
22 lines
708 B
import reduce from 'lodash/reduce'
|
|
import { MatchInfo, TeamStatItem } from 'requests'
|
|
import { TeamsStats } from 'features/MatchPage/store/hooks/useTeamsStats'
|
|
|
|
export type StatsLexicType = {
|
|
matchProfile: MatchInfo,
|
|
stats: TeamsStats,
|
|
}
|
|
export const getStatsLexics = ({ matchProfile, stats }: StatsLexicType) => (
|
|
matchProfile
|
|
? reduce<TeamStatItem, Array<number>>(
|
|
stats[matchProfile.team1.id],
|
|
(acc, curr) => {
|
|
!acc.includes(curr.lexic) && acc.push(curr.lexic)
|
|
!acc.includes(curr.param1.lexic) && acc.push(curr.param1.lexic)
|
|
curr.param2 && !acc.includes(curr.param2.lexic) && acc.push(curr.param2.lexic)
|
|
|
|
return acc
|
|
},
|
|
[],
|
|
)
|
|
: [])
|
|
|