Returns a formatted string given a value, currency, and buffer. buffer defaults to 3,
based on handleSignificantDecimals.
Calculation of the amount in the formatted string is as follows.
If value is between -1 and 1, the amount is value rounded to one of the
following decimal places (whichever is smaller), then formatted to a minimum of 2 decimal places:
8
number of decimal places to reach value's first significant digit + buffer.
Buffer basically acts as the number of significant digits to show
Otherwise the amount is value rounded to the smaller of the specified currency's decimals and buffer,
formatted with at least 2 decimal places.
Example
convertAmountToNativeDisplay(1.112, 'USD', 1) // $1.10 USD - the buffer is smaller than the 2 decimal places specified by USD convertAmountToNativeDisplay(1.112, 'USD', 3) // '$1.11 USD' - USD specifies 2 decimal places
Returns a formatted string given a
value
,currency
, andbuffer
.buffer
defaults to 3, based onhandleSignificantDecimals
.Calculation of the amount in the formatted string is as follows. If
value
is between -1 and 1, the amount isvalue
rounded to one of the following decimal places (whichever is smaller), then formatted to a minimum of 2 decimal places:value
's first significant digit +buffer
. Buffer basically acts as the number of significant digits to showOtherwise the amount is
value
rounded to the smaller of the specified currency's decimals andbuffer
, formatted with at least 2 decimal places.Example
See
handleSignificantDecimals for more details on calculating amount