just-median
v2.2.0
Published
return the median value of an array of numbers
Downloads
3,466
Readme
just-median
Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.
npm install just-median
yarn add just-median
Return the median value of an array of numbers
import median from 'just-median';
median([1, 2, 3, 4, 5]); // 3
median([3, -1, 2]); // 2
median([9, 14, 14, 200, 15]); // 14
median(1, 2, 4, 3); // 2.5
median(['3', 2, 1]); // throws
median(); // throws