mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
JS: Allow an integer factor in Amount#product_human.
This commit is contained in:
@@ -380,7 +380,12 @@ Amount.prototype.ratio_human = function (denominator) {
|
||||
* @return {Amount} The product. Unit will be the same as the first factor.
|
||||
*/
|
||||
Amount.prototype.product_human = function (factor) {
|
||||
if ("number" === typeof factor && parseInt(factor) === factor) {
|
||||
// Special handling of integer arguments
|
||||
factor = Amount.from_json("" + factor + ".0");
|
||||
} else {
|
||||
factor = Amount.from_json(factor);
|
||||
}
|
||||
|
||||
var product = this.multiply(factor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user