1.0.2 • Published 6 years ago

smry v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

smry

Computes a summary for number array

Build Status NPM version

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 in smry. Defaults to false.
    • 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 array
  • max - maximum value of array
  • sum - sum of all array elements
  • len - size of array
  • avg - average value of all array elements
  • quantile - object with specified quantiles of array (only if quantile 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

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago