currency-formatter
currency-formatter copied to clipboard
extend with new currency (crypto)
Is it possible to extend the number of currency supported via code?
You mean you want to add a missing currency? If so, we gladly accept PR's to currencies.json
, and localeFormats.json
:smile:
I would like to add missing currency for cryptos. Is there a way to add it only for me? I don't think everyone would be interested.
On Fri, Apr 13, 2018 at 5:27 PM Edo Rivai [email protected] wrote:
You mean you want to add a missing currency? If so, we gladly accept PR's to currencies.json https://github.com/smirzaei/currency-formatter/blob/master/currencies.json, and localeFormats.json https://github.com/smirzaei/currency-formatter/blob/master/localeFormats.json 😄
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/smirzaei/currency-formatter/issues/56#issuecomment-381171592, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI69oTbuLawHD7Gpkm3bSlq9impqcH5ks5toMPMgaJpZM4TTXU4 .
@StErMi a PR is just a simple step, but maybe you are out of the time, if you wan to register a currency you could do it liek this
const currencyFormatter = require('currency-formatter');
// suppose you are using a Bitcoin symbol like this 'BIT'
// get the default currency options
const defaults = currencyFormatter.defaultCurrency;
// add your custom currency options
const customCurrency = { symbol: 'BIT', code: 'BIT', format: '%v %s' } // where %v is for value and %s is for symbol
// merge your currency options
const myCurrency = { defaults..., ...customCurrency };
// and finally you can call the formatter like usually you do
currencyFormatter.format(2320, myCurrency)