Skip to content

Commit 2a55fea

Browse files
paul-shuvopaul-shuvo
authored andcommitted
Fix: fixed the conversion on big amount issue #18
1 parent db5a045 commit 2a55fea

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,5 @@ coverage.lcov
120120
.nyc_output/
121121

122122
.vscode
123-
t.js
123+
t.js
124+
s.js

index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,18 +211,19 @@ class CurrencyConverter {
211211
else
212212
return got(`https://www.google.co.in/search?q=${this.currencyAmount}+${this.currencyFrom}+to+${this.currencyTo}`)
213213
.then((html) => {
214-
// const fs = require('fs');
214+
const fs = require('fs');
215215

216-
// fs.writeFile("a.html", html.body, function(err) {
217-
// if(err) {
218-
// return console.log(err);
219-
// }
220-
// console.log("The file was saved!")})
216+
fs.writeFile("a.html", html.body, function(err) {
217+
if(err) {
218+
return console.log(err);
219+
}
220+
console.log("The file was saved!")})
221221
return cheerio.load(html.body)})
222222
.then(($) => {return $(".iBp4i").text().split(" ")[0]})
223223
.then((rates) => {
224+
console.log(rates)
224225
if(rates.includes(","))
225-
rates = rates.replace(",", "")
226+
rates = rates.replaceAll(",", "")
226227
return parseFloat(rates)
227228
})
228229
}

0 commit comments

Comments
 (0)