The current Amount proposal allows code such as
let amt1 = new Amount(2.5, { unit: "meter" });
let amt2 = amt1.withNumber(amt1.toNumber() * 2);
Without the helper functions withNumber and toNumber, the code is still possible, though a bit more verbose, perhaps worth moving into a helper function:
function doubleAmount(amt) {
let number = Number.parseFloat(amt.toString());
return new Amount(number * 2, { unit: amt.unit });
}
A concern here is that if developers are encouraged to use such a pattern, the resulting code is less efficient than if they had not converted to an Amount, if the Amount is stored as a decimal-like type.