[go: up one dir, main page]

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

2.0.0 • Public • Published

mediana

Calculate the Median Value of an Array of Numbers (Typed or Untyped)

why "mediana"?

Mediana is Spanish for median.

install

npm install mediana

usage

const mediana = require("mediana");

const nums = [0, 56, 123, 63, 763, ...];
mediana.calculate(nums);
123.4567

// ignore zeros
mediana.calculate(nums, { no_data: 0 });
876.5432

// ignore multiple numbers
mediana.calculate(nums, { no_data: [-99, 0] });
987.6543

// calculate median with infinite precision using preciso
mediana.calculate(nums, { precise: true })
"128.1231236542451283153614234128736127354564"

script usage

If you want to use this on a web page, you can also install using a script tag

in a web page

<script src="https://unpkg.com/mediana"></script>

<script>
  mediana.calculate(nums);
</script>

Package Sidebar

Install

npm i mediana

Weekly Downloads

3,240

Version

2.0.0

License

CC0-1.0

Unpacked Size

40.1 kB

Total Files

8

Last publish

Collaborators

  • danieljdufour