$ npm install --save @touch4it/currency-formatObject constructor
Options:
amount(required) - Price amountcurrency(optional, default:USD) - Price currency
Print string with correct number of decimal places
Options:
decimals(optional, default: calculated from currency) - Decimal places in output
Return:
Formatted string
Return number in the smallest currency unit
Options:
decimals(optional, default: calculated from currency) - Decimal places in input
Return:
Number
Add amount to previous amount
Options:
amount(required) - Amount to be added
Return:
Object (this)
Subtract amount from previous amount
Options:
amount(required) - Amount to be subtracted
Return:
Object (this)
Calculate VAT amount
Options:
vatPercent(required) - Percent of VAT as number (e.g.40for 40%)
Return:
VAT amount as string with correct number of decimal places
Add VAT amount to previous amount
Options:
vatPercent(required) - Percent of VAT (e.g.40for 40%)
Return:
Object (this)
See tests
MIT