4.2.0 • Published 1 year ago

just-percentile v4.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

just-percentile

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-percentile
yarn add just-percentile

Return the value at the given percentile (using linear interpolation)

import percentile from 'just-percentile';

percentile([1, 2, 3], 0); // 1
percentile([1, 2, 3], 0.5); // 2
percentile([1, 2, 3], 1); // 3

// See https://en.wikipedia.org/wiki/Percentile (linear interpolation method)
percentile([15, 20, 35, 40, 50], 0.05); // 15
percentile([15, 20, 35, 40, 50], 0.3); // 20
percentile([15, 20, 35, 40, 50], 0.4); // 27.5
percentile([15, 20, 35, 40, 50], 0.95); // 50

percentile(1, 2, 3, 50); // throws
percentile(['1', 2, 3], 50); // throws
percentile([], 50); // throws
4.2.0

1 year ago

4.1.0

2 years ago

4.1.1

2 years ago

4.0.0

2 years ago

3.0.1

2 years ago

3.0.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago