crnc

currency conversion and functionality for the web

Usage no npm install needed!

<script type="module">
  import crnc from 'https://cdn.skypack.dev/crnc';
</script>

README

-c-r-n-c-
currency conversions and formatting for the web

npm install crnc

  • this is the currency library for shopper
  • downloads exchange rates from the bank of canada's public api
  • caches results in localStorage for an hour by default
  • no real documentation, read the source (so sorry)
  • open source, contributions welcome

crnc is a collection of handy functions

currency tools

  • downloadExchangeRates
    download somewhat up-to-date currency exchange info from the internet

  • convertCurrency
    exchange a money value from one currency to another

  • formatCurrency
    express a money value as a human-readable string
    (adds dollar signs and commas and stuff)

  • convertAndFormatCurrency
    exchange a money value, and format it, in one shot
    (simply a convenience function, combines the two above)

ecommerce helpers