Do not require qualified hitters for sb/cs
This commit is contained in:
parent
dd1d1af8bd
commit
71e7c7fcf7
@ -263,6 +263,9 @@ export default {
|
|||||||
return this.getTop10FieldingStatByCategory(stat as keyof FlatFieldingStat)
|
return this.getTop10FieldingStatByCategory(stat as keyof FlatFieldingStat)
|
||||||
},
|
},
|
||||||
getTop10BattingStatByCategory(stat: keyof BattingStat): BattingStat[] {
|
getTop10BattingStatByCategory(stat: keyof BattingStat): BattingStat[] {
|
||||||
|
if (['sb', 'cs'].includes(stat)) {
|
||||||
|
return this.allPlayersBattingStats.concat([]).sort((a, b) => (b[stat] as number) - (a[stat] as number)).slice(0, 10)
|
||||||
|
}
|
||||||
// concat an empty array so that the existing array is not sorted as a side effect
|
// concat an empty array so that the existing array is not sorted as a side effect
|
||||||
return this.qualifyingBattingStats.concat([]).sort((a, b) => (b[stat] as number) - (a[stat] as number)).slice(0, 10)
|
return this.qualifyingBattingStats.concat([]).sort((a, b) => (b[stat] as number) - (a[stat] as number)).slice(0, 10)
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user