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.
25 lines
520 B
25 lines
520 B
import toUpper from 'lodash/toUpper'
|
|
import split from 'lodash/split'
|
|
import size from 'lodash/size'
|
|
|
|
import pipe from 'lodash/fp/pipe'
|
|
import take from 'lodash/fp/take'
|
|
import join from 'lodash/fp/join'
|
|
import map from 'lodash/fp/map'
|
|
|
|
export const getTeamAbbr = (teamName: string) => {
|
|
const nameParts = split(teamName, ' ')
|
|
|
|
return size(nameParts) > 1
|
|
? pipe(
|
|
map(take(1)),
|
|
join(''),
|
|
toUpper,
|
|
)(nameParts)
|
|
|
|
: pipe(
|
|
take(3),
|
|
join(''),
|
|
toUpper,
|
|
)(nameParts[0])
|
|
}
|
|
|