@@ -44,7 +44,7 @@ class Cashify {
44
44
}
45
45
46
46
/**
47
- * @param {number } amount Amount of money you want to convert
47
+ * @param {number } amount Amount of money you want to convert (in decimal, e.g., $1 = 1.00)
48
48
* @param {object } options Conversion options
49
49
* @param {string } options.from Currency from which you want to convert
50
50
* @param {string } options.to Currency to which you want to convert
@@ -58,12 +58,12 @@ class Cashify {
58
58
return amount ;
59
59
}
60
60
61
- return amount * getRate ( { base, rates, from, to} ) ;
61
+ return ( amount * 100 ) * getRate ( { base, rates, from, to} ) / 100 ;
62
62
}
63
63
}
64
64
65
65
/**
66
- * @param {number } amount Amount of money you want to convert
66
+ * @param {number } amount Amount of money you want to convert (in decimal, e.g., $1 = 1.00)
67
67
* @param {object } options Conversion options
68
68
* @param {string } options.from Currency from which you want to convert
69
69
* @param {string } options.to Currency to which you want to convert
@@ -77,7 +77,7 @@ const convert = (amount: number, {from, to, base, rates}: Options): number => {
77
77
return amount ;
78
78
}
79
79
80
- return amount * getRate ( { base, rates, from, to} ) ;
80
+ return ( amount * 100 ) * getRate ( { base, rates, from, to} ) / 100 ;
81
81
} ;
82
82
83
83
export {
0 commit comments