Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rodrigobdz/percentage-diff
Calculate percentage difference between two numbers
https://github.com/rodrigobdz/percentage-diff
decrease delta increase math-calculator npm-module numbers-comparison percentage-calculator percentage-change yarn
Last synced: about 1 month ago
JSON representation
Calculate percentage difference between two numbers
- Host: GitHub
- URL: https://github.com/rodrigobdz/percentage-diff
- Owner: rodrigobdz
- License: mit
- Created: 2019-04-23T16:42:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-23T17:15:15.000Z (over 5 years ago)
- Last Synced: 2024-11-08T04:12:22.919Z (2 months ago)
- Topics: decrease, delta, increase, math-calculator, npm-module, numbers-comparison, percentage-calculator, percentage-change, yarn
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/percentage-diff
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
# percentage-diff [![Build Status](https://travis-ci.com/rodrigobdz/percentage-diff.svg?branch=master)](https://travis-ci.com/rodrigobdz/percentage-diff) [![codecov](https://codecov.io/gh/rodrigobdz/percentage-diff/badge.svg?branch=master)](https://codecov.io/gh/rodrigobdz/percentage-diff?branch=master)
> Calculate percentage difference between two numbers
## Install
```sh
$ npm install percentage-diff
```## Usage
```js
const percentageDiff = require('percentage-diff');percentageDiff(50, 75);
//=> 50
percentageDiff.toPercentage(50);
//=> 50%
percentageDiff(45,35);
//=> -22.22
```## API
### percentageDiff(firstNr, secondNr)
#### firstNr
Type: `number`
#### secondNr
Type: `number`
### percentageDiff.toPercentage(value)
#### value
Type: `number`
## Credits
* [generator-lnm](https://github.com/rodrigobdz/generator-lnm) - Awesome node module generator
## License
[MIT](license) © [Rodrigo Bermudez Schettino](https://rodrigobdz.github.io)