We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
from
to
1 parent 400090a commit 5c1dee3Copy full SHA for 5c1dee3
src/index.ts
@@ -13,8 +13,8 @@ function hasKey<T>(obj: T, key: keyof any): key is keyof T {
13
14
const getRate = ({base, rates, from, to}: Options): number => {
15
if (hasKey(rates, to)) {
16
- // If `from` equals `base`, return the basic exchange rate for the `to` currency
17
- if (from === base) {
+ // If `from` equals `base` or `from` equals `to`, return the basic exchange rate for the `to` currency
+ if (from === base || from === to) {
18
return rates[to];
19
}
20
0 commit comments