# mediana

> A Quick and Precise Library for Calculating the Median Value of an Array of Numbers (Typed or Untyped)

Latest version **2.0.0** (published 2024-01-13) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install mediana
pnpm add mediana
yarn add mediana
bun add mediana
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-01-13 |
| First published | 2022-06-27 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 39.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Daniel J. Dufour |
| Maintainers | danieljdufour |
| Keywords | fast, faster, fastest, image, integers, math, median, no-data, numbers, pixels, quick, speed, stats |

## Links

- npm: https://www.npmjs.com/package/mediana
- Repository: https://github.com/DanielJDufour/mediana
- Homepage: https://github.com/DanielJDufour/mediana#readme
- Issues: https://github.com/DanielJDufour/mediana/issues
- npm.io page: https://npm.io/package/mediana

## Dependencies (1)

- [preciso](https://npm.io/package/preciso.md) ^0.12.2

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2024-01-13
- 1.0.3 — 2022-06-28
- 1.0.2 — 2022-06-28
- 1.0.1 — 2022-06-27

## README

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

# why "mediana"?
Mediana is Spanish for median.

## install
```bash
npm install mediana
```

### usage
```js
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
```html
<script src="https://unpkg.com/mediana"></script>

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

---
_Source: https://npm.io/package/mediana · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
