README
currency conversions and formatting for the web
-c-r-n-c- 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 internetconvertCurrency
exchange a money value from one currency to anotherformatCurrency
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
ascertainEcommerceDetails
enhanced logic to retrieve exchange rates, fallback onto dud, cachingassumeUserCurrency
assume what currency the user might want to see based on locale