mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-11 12:30:17 +00:00
Refactoring aggregations.js (#1646)
* Update aggregations.js * Update aggregations.js
This commit is contained in:
committed by
Tanner Linsley
parent
dd0d6d6640
commit
6ccdce9908
+3
-7
@@ -7,13 +7,9 @@ export function average(values, rows) {
|
||||
}
|
||||
|
||||
export function median(values) {
|
||||
let min = values[0] || ''
|
||||
let max = values[0] || ''
|
||||
|
||||
values.forEach(value => {
|
||||
min = Math.min(min, value)
|
||||
max = Math.max(max, value)
|
||||
})
|
||||
values = values.length ? values : [0]
|
||||
let min = Math.min(...values)
|
||||
let max = Math.max(...values)
|
||||
|
||||
return (min + max) / 2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user