0.5.15
Setting defaults for stats functions given empty arrays
Previously, the behavior of utility functions — utils.max
, utils.min
, and others, was unspecified if passed an empty array. It turns out that utils.max
actually returned -Infinity
(this is native JS behavior for Math.max()
when no arguments are passed!)
Now, most stats functions return null
if passed an empty array. This includes:
utils.max
utils.min
utils.mean
utils.median
utils.stdDev
The one exception is utils.sum
, which returns 0
. While this does differ from the behavior of the others, I would argue that summing 'starts' from 0
, while the other functions have no clear 'starting point.' In any case, one should be aware of this behavior whenever passing an empty array to one of these functions.