Calculate percentage
Install
$ npm install --save calc-percent
Usage
var calcPercent = ; ;//=> 20 ;//=> 20% ;//=> 33.33
API
calcPercent(val, total, opts)
val
Type: number
Value which should be calculated.
total
Type: number
Total that val
should be compared against.
opts.decimal
Type: number
Default: 0
Number of decimals.
opts.suffix
Type: string
Append a suffix.
License
MIT © Kevin Mårtensson