Skip to content

Commit

Permalink
fix .median sort function
Browse files Browse the repository at this point in the history
  • Loading branch information
pmario committed Mar 3, 2025
1 parent 0dda07e commit 1c45f8d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/modules/filters/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ exports.minall = makeNumericReducingOperator(
exports.median = makeNumericArrayOperator(
function(values) {
var len = values.length, median;
values.sort();
values.sort(function(a,b) {return a-b});
if(len % 2) {
// Odd, return the middle number
median = values[(len - 1) / 2];
Expand Down

0 comments on commit 1c45f8d

Please sign in to comment.