npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

currenzy

v1.2.0

Published

Get currencies exchange rates

Downloads

26

Readme

Currenzy - Exchange Rates

CI

Free module to get the conversion rates for dozens of currencies. Conversion rates are updated via GitHub Actions every 12 hours.

Note: The module fetches the latest rates from a URL, not the local file (i.e. there is no need to update the package to get the newest rates).

Installation

npm install currenzy

Usage

Initialize Currenzy with the base currency. If not provided, the base currency by default is EUR. Currency uses the ISO 4217 standard.

import Currenzy from 'currenzy';

const currenzy = new Currenzy('EUR');

Methods

Conversion

To make a conversion, add the amount and the target currency:

const amountInUSD = await currenzy.convert(5, 'USD');
// 5.266205

Refresh rates

The class instance downloads the latest rates from this repo, but saves the results in memory.

The convert() method automatically checks if the data is older than 6 hours. If so, it fetches again the data.

However, you can re-fetch the latest rates using the refreshRates method:

await currenzy.refreshRates();

Currencies

This is the list of supported currencies by Currenzy:

| | | | | | | | | | |-----|-----|-----|-----|-----|-----|-----|-----|-----| | AED | BRL | CZK | GYD | KHR | MMK | PGK | SOS | UZS | | AFN | BSD | DJF | HKD | KMF | MNT | PHP | SRD | VEF | | ALL | BTC | DKK | HNL | KPW | MOP | PKR | STD | VES | | AMD | BTN | DOP | HRK | KRW | MRO | PLN | SVC | VND | | ANG | BWP | DZD | HTG | KWD | MUR | PYG | SYP | VUV | | AOA | BYN | EGP | HUF | KYD | MVR | QAR | SZL | WST | | ARS | BYR | ERN | IDR | KZT | MWK | RON | THB | XAF | | AUD | BZD | ETB | ILS | LAK | MXN | RSD | TJS | XAG | | AWG | CAD | EUR | IMP | LBP | MYR | RUB | TMT | XAU | | AZN | CDF | FJD | INR | LKR | MZN | RWF | TND | XCD | | BAM | CHF | FKP | IQD | LRD | NAD | SAR | TOP | XDR | | BBD | CLF | GBP | IRR | LSL | NGN | SBD | TRY | XOF | | BDT | CLP | GEL | ISK | LTL | NIO | SCR | TTD | XPF | | BGN | CNY | GGP | JEP | LVL | NOK | SDG | TWD | YER | | BHD | COP | GHS | JMD | LYD | NPR | SEK | TZS | ZAR | | BIF | CRC | GIP | JOD | MAD | NZD | SGD | UAH | ZMK | | BMD | CUC | GMD | JPY | MDL | OMR | SHP | UGX | ZMW | | BND | CUP | GNF | KES | MGA | PAB | SLE | USD | ZWL | | BOB | CVE | GTQ | KGS | MKD | PEN | SLL | UYU | |

CLI support

You can also use Currenzy from your terminal!

Install the package globally:

npm install currenzy@latest -g

Use as follows:

cur <fromAmount> <fromCurrency> <targetCurrency>

Example:

cur 1 eur usd

Would output: 1.081233 USD


Template

Used the package template from get-template

npx get-template@latest package