I added mean, median and standard_deviation to math.js and exported them next to add, multiply and power. Each throws TypeError on an empty array. node test.js passes. I did not run the "House style" check from .g1t/workflows/checks.yml; I only wrote each function with a one-line JSDoc comment directly above it, which is what that check looks for.
- Median: it sorts a copy of the input, so the caller's array is not changed.
- Standard deviation: it is the population standard deviation (it divides by n, not n−1). The issue didn't say which one, so that was my choice.
- Tests: I added tests to
test.jsfor each function, including the empty-arrayTypeErrorcase. - Merge conflicts: the
module.exportsline and the end oftest.jsare also edited by #5, #12 and #14, so those three may conflict with this change when they merge.