# calculate-percent

> Tiny easy to find percentage calculator.

Latest version **2.1.0** (published 2021-07-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install calculate-percent
pnpm add calculate-percent
yarn add calculate-percent
bun add calculate-percent
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2021-07-14 |
| First published | 2018-06-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 34.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | fantasyui.com |
| Maintainers | fantasyui.com |

## Links

- npm: https://www.npmjs.com/package/calculate-percent
- Repository: https://github.com/fantasyui-com/calculate-percent
- Homepage: https://github.com/fantasyui-com/calculate-percent#readme
- Issues: https://github.com/fantasyui-com/calculate-percent/issues
- npm.io page: https://npm.io/package/calculate-percent

## Recent versions

- 2.1.0 (latest) — 2021-07-14
- 2.0.2 — 2020-05-12
- 1.3.0 — 2019-05-12
- 1.2.0 — 2018-06-13
- 1.1.0 — 2018-06-13

## README

# calculate-percent
Tiny easy to find percentage calculator that returns a simple integer [Algorithm, Math]

```JavaScript
const calculatePercentSimple = require('calculate-percent/simple.js');

const val = 50;
const max = 100;

console.log( calculatePercentSimple(val, max) ); // -> 50

```

Please note that min is optional and zero by default

```JavaScript
const calculatePercent = require('calculate-percent');

const val = 0;
const min = -100;
const max = 100;

console.log( calculatePercent(val, max, min) ); // -> 50

```

## Breaking API Changes in 2.x

I felt that returning a fraction, and asking for precision was making things too difficult.
I think it is best to simply pct(250, 1000) and be done with it. In the rare case that one is not working with zero we add the min: pct(250,1000,-1000).

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