Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@easymoney/currencies

1.0.2 • Public • Published

easy money logo

@easymoney/currencies

npm-currencies npm type definitions deps-currencies size-currencies GitHub

Open in docs

Install

npm install @easymoney/currencies

or

yarn add @easymoney/currencies

or

CDN

Usage

import { createCurrencyList } from '@easymoney/currencies';
 
const currency = { minorUnit: 2, code: 'XBT' };
const currency1 = { minorUnit: 5, code: 'DXBT' };
const currencyArr = [currency, currency1];
 
const list = createCurrencyList(currencyArr);
 
const result = list.getCurrencies();
// =>   { XBT: {minorUnit: 2, code: "XBT"},
//       DXBT: {minorUnit: 5, code: "DXBT"} }
 
const resultLength = Object.keys(result).length === currencyArr.length ? true : false;
// => true
 
import { createCurrencyList, createAgregatedCurrencyList } from '@easymoney/currencies';
 
const currency = { minorUnit: 2, code: 'XBT' };
const currency1 = { minorUnit: 5, code: 'DXBT' };
const currencyArr = [currency, currency1];
 
const list = createCurrencyList(currencyArr);
const agregatedList = createAgregatedCurrencyList([list]);
 
const result = agregatedList.subUnitFor("XBT");
// => 2
 

Install

npm i @easymoney/currencies

DownloadsWeekly Downloads

234

Version

1.0.2

License

MIT

Unpacked Size

199 kB

Total Files

32

Last publish

Collaborators

  • avatar