README
smry
Computes a summary for number array
Install
npm i smry
Usage
smry(array, options);
array
- array of numbers for computing statistic summary.options
(optional) - object with following options:sorted
- Boolean.true
means that object preliminarily sorted. Otherwise it will be sorted insmry
. Defaults tofalse
.fractionDigits
- number of digits to appear after the decimal point in every summary field. Defaults to 10.quantile
- probability (number between 0 and 1) for computing quantile of array. Or array of probabilities.
Returns object with following fields:
min
- minimum value of arraymax
- maximum value of arraysum
- sum of all array elementslen
- size of arrayavg
- average value of all array elementsquantile
- object with specified quantiles of array (only ifquantile
option present).
Example
const smry = require('smry');
console.log(smry([4, 1, 3, 5, 2]));
/*
{ min: 1,
max: 5,
sum: 15,
len: 5,
avg: 3 }
*/
License
MIT