Skip to content

Commit

Permalink
fix: issue #56
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-shuvo committed Oct 22, 2023
1 parent 6d1cd63 commit 0377813
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class CurrencyConverter {
});
} else {
return new Promise((resolve, reject) => {
request(`https://www.google.com/search?q=${this.currencyFrom}+to+${this.currencyTo}+&hl=en`, function(error, response, body) {
request(`https://www.google.com/search?q=${this.currencyAmount}+${this.currencyFrom}+to+${this.currencyTo}+&hl=en`, function(error, response, body) {
if (error) {
return reject(error);
} else {
Expand All @@ -294,10 +294,11 @@ class CurrencyConverter {
if (rates.includes(","))
rates = this.replaceAll(rates, ",", "")
}
rates = parseFloat(rates) / this.currencyAmount
if (this.isRatesCaching) {
this.addRateToRatesCache(currencyPair, parseFloat(rates));
this.addRateToRatesCache(currencyPair, rates);
}
return parseFloat(rates)
return rates
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "currency-converter-lt",
"version": "2.0.0",
"version": "2.0.1",
"description": "A nodejs currency converter library that doesn't require subscribing to any API calls.",
"main": "index.js",
"dependencies": {
Expand Down

0 comments on commit 0377813

Please sign in to comment.