Last active
October 20, 2017 16:39
-
-
Save isacjunior/48c3f50dcd64d4e865b98f961b4f401d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sales = [ | |
{ name: 'João', amount: 11792.23, currency: 'BRL', country: 'Brazil', language: 'pt-BR' }, | |
{ name: 'Manoel', amount: 3899.05, currency: 'EUR', country: 'Portugal', language: 'pt-PT' }, | |
{ name: 'José', amount: 259, currency: "USD", country: 'United States', language: 'en-US' } | |
] | |
const formatCurrency = ({ amount, language, currency }) => { | |
return { | |
amountFormatted: amount.toLocaleString(language, { style: 'currency', currency: currency }) | |
} | |
} | |
const amountWithCurrency = sales.map(formatCurrency) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment