Skip to content

rodrigobdz/percentage-diff

Repository files navigation

percentage-diff Build Status codecov

Calculate percentage difference between two numbers

Install

$ npm install percentage-diff

Usage

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

License

MIT © Rodrigo Bermudez Schettino