just-median
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

just-median

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

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

Package Sidebar

Install

npm i just-median

Weekly Downloads

855

Version

2.2.0

License

MIT

Unpacked Size

4.95 kB

Total Files

9

Last publish

Collaborators

  • angus-c