Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const cheerio = require("cheerio")
const got = require("got")
const decimal = require("decimal.js")

// FIXME: round upto 2 decimal places
// TODO: Add doc for other functions
Expand Down Expand Up @@ -235,7 +236,7 @@ class CurrencyConverter {
throw new Error("currency amount should be a positive value")

return this.rates().then((rates) =>{
this.convertedValue = rates * this.currencyAmount
this.convertedValue = new decimal(rates).mul(this.currencyAmount)
return this.convertedValue
})
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"dependencies": {
"cheerio": "latest",
"decimal.js": "latest",
"got": "latest"
},
"devDependencies": {
Expand Down