Finished bw stats table
This commit is contained in:
17
src/lib/funcs.ts
Normal file
17
src/lib/funcs.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export function concatStatArrays(...arrays: number[][]) {
|
||||
if (arrays.length === 0) return []
|
||||
|
||||
const indexes = [2, 5, 8]
|
||||
|
||||
const result = arrays[0].map((v, index) => {
|
||||
if (v < 0) return "?"
|
||||
|
||||
if (indexes.includes(index) || index === arrays[0].length - 1) {
|
||||
return arrays.reduce((sum, array) => sum + array[index], 0) / arrays.length
|
||||
}
|
||||
|
||||
return arrays.reduce((sum, array) => sum + array[index], 0)
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user