him-ich-currency-converter

A piece of code that do the currency converter.

Usage no npm install needed!

<script type="module">
  import himIchCurrencyConverter from 'https://cdn.skypack.dev/him-ich-currency-converter';
</script>

README

him-ich-currency-converter

A piece of code that do the currency converter.

Installation

Using npm:

npm install him-ich-currency-converter

fromUSDToCustomAsset(usd_amount, per_usd)

Convert the amount in USD to the other amount of Custom Asset on Stellar

var { fromUSDToCustomAsset } = require('him-ich-currency-converter');

const usd_amount = 2; // $
const per_usd = 40; // 1$ == 40

console.log(fromUSDToCustomAsset(usd_amount, per_usd)); // 80

fromUSDToKHR(usd_amount, per_usd = 4000)

Convert the amount in USD to KHR

var { fromUSDToKHR } = require('him-ich-currency-converter');

const usd_amount = 2; // $

console.log(fromUSDToKHR(usd_amount)); // 8000 riels

fromCustomAssetToUSD(custom_asset_amount, per_usd)

Convert the Custom Asset on Stellar to USD

var { fromCustomAssetToUSD } = require('him-ich-currency-converter');

const custom_asset_amount = 500;
const per_usd = 40; // 40 == 1$

console.log(fromCustomAssetToUSD(custom_asset_amount, per_usd)); // 5$