smry

1.0.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i smry

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

6.91 kB

Total Files

8

Last publish

Collaborators

  • astur