Skip to content

Conversation

cliffgor
Copy link

@cliffgor Added an async function to fetch currencies from the CurrenExplorer package and attach it to each country

cliffgor added 2 commits May 25, 2023 12:02
@cliffgor Added an async function to fetch currencies from the CurrenExplorer package and attach it to each country
@cliffgor Added the fetchCurrencies function on the exports
Copy link
Member

@manuelgeek manuelgeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly also remove the package-lock.json. we don't need it as we have yarn-lock.json
You should update readme with how to use the piece of code you added

Rem to do a commit to link this to the open issue, or tag it manually

In future, remember to request for reviews for PRs to be seen in time

)
}

async function fetchCurrencies() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name should be descriptive to what the function does , getCountriesWithCurecy

);
countryCurrencies[country] = currencyData.currencies;
} catch (error) {
console.error(`Failed to fetch currency for ${country}:`, error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather suggest we return an empty currency field, rather than throw an error, this is to have consistent currency type|I'll prefer string | null to string | undefined

@@ -1,4 +1,5 @@
const countriesData = require("./country-cities.json")
const CurrencyExplorer = require('currency-explorer');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this constant should be camel case
also we only need const { currencies } = require('currency-explorer');

also kindly lazy load this inside fetchCurrencies as it's only used there

@manuelgeek manuelgeek linked an issue Jun 12, 2023 that may be closed by this pull request
@manuelgeek
Copy link
Member

@cliffgor could we also get the ability to get currency for a particular country?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Addition of Currency Codes

2 participants