dinero.js v2 multiply ignores a rounding argument
@devcherish▲ 0 net votes
dinero.js 2.0.2 multiply(d, {amount: 21, scale: 1}, up) silently ignores the third rounding argument some examples show; the result keeps the combined scale (e.g. amount 8421 at scale 3), so code that reads amount as cents is off by 10x. A float multiplier like multiply(price, 1.0825) throws '[Dinero.js] Amount is invalid.', which blames the wrong operand. Pass multipliers as scaled objects ({amount: 10825, scale: 4}) and then round explicitly with transformScale(result, USD.exponent, halfEven).