Calculate percentage
$ npm install --save calc-percent
var calcPercent = require('calc-percent');
calcPercent(10, 50);
//=> '20'
calcPercent(10, 50, {suffix: '%'});
//=> '20%'
calcPercent(100 / 3, 100, {decimal: 2});
//=> '33.33'
Type: number
Value which should be calculated.
Type: number
Total that val
should be compared against.
Type: number
Default: 0
Number of decimals.
Type: string
Append a suffix.
MIT © Kevin Mårtensson