Skip to content

How do you find the currency from its code? #648

Discussion options

You must be logged in to vote

The simplest way is to import all the currencies and to find the right module from its name.

import * as currencies from '@dinero.js/currencies';

const currencyCode = 'USD';
const dineroCurrency = currencies[currencyCode];

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sarahdayan
Comment options

Answer selected by sarahdayan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants