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

exchain

v3.0.0

Published

A fast and flexible currency exchange package for handling multiple currencies.

Downloads

207

Readme

Installation

Using npm:

$ npm install exchain

Other Installations:

$ yarn add exchain
$ pnpm add exchain

Usage

import exchain from 'exchain';

(async () => {

// Get Rates
var getRates = await exchain.getRates({
    amount: 2,
    base: 'USD',
    to: ['AUD', 'EUR', 'GBP', 'TRY'],
    toFixed: 2
});

console.log(getRates);
/*
{
  amount: 2,
  base: 'USD',
  date: '2024-10-22',
  rates: { AUD: 2.99, EUR: 1.85, GBP: 1.54, TRY: 68.5 }
}
*/



// Get Rates with date
var getRatesWithDate = await exchain.getRates({
    amount: 2,
    base: 'USD',
    to: ['AUD', 'EUR', 'GBP', 'TRY'],
    startDate: '2024-10-15',
    endDate: '2024-10-22',
});

console.log(getRatesWithDate);
/*
{
  amount: 2,
  base: 'USD',
  start_date: '2024-10-15',
  end_date: '2024-10-22',
  rates: {
    '2024-10-15': { AUD: 2.9783, EUR: 1.8344, GBP: 1.529, TRY: 68.516 },
    '2024-10-16': { AUD: 2.99, EUR: 1.8354, GBP: 1.5345, TRY: 68.421 },
    '2024-10-17': { AUD: 2.9869, EUR: 1.8406, GBP: 1.5361, TRY: 68.318 },
    '2024-10-18': { AUD: 2.9805, EUR: 1.8438, GBP: 1.5334, TRY: 68.585 },
    '2024-10-21': { AUD: 2.9909, EUR: 1.8428, GBP: 1.5353, TRY: 68.509 },
    '2024-10-22': { AUD: 2.9899, EUR: 1.8483, GBP: 1.5403, TRY: 68.496 }
  }
}
*/



// Get Currencies
var getCurrencies = await exchain.getCurrencies();

console.log(getCurrencies);
/*
{
  AUD: 'Australian Dollar',
  BGN: 'Bulgarian Lev',
  BRL: 'Brazilian Real',
  CAD: 'Canadian Dollar',
  CHF: 'Swiss Franc',
  CNY: 'Chinese Renminbi Yuan',
  CZK: 'Czech Koruna',
  DKK: 'Danish Krone',
  EUR: 'Euro',
  GBP: 'British Pound',
  HKD: 'Hong Kong Dollar',
  HUF: 'Hungarian Forint',
  IDR: 'Indonesian Rupiah',
  ILS: 'Israeli New Sheqel',
  INR: 'Indian Rupee',
  ISK: 'Icelandic Króna',
  JPY: 'Japanese Yen',
  KRW: 'South Korean Won',
  MXN: 'Mexican Peso',
  MYR: 'Malaysian Ringgit',
  NOK: 'Norwegian Krone',
  NZD: 'New Zealand Dollar',
  PHP: 'Philippine Peso',
  PLN: 'Polish Złoty',
  RON: 'Romanian Leu',
  SEK: 'Swedish Krona',
  SGD: 'Singapore Dollar',
  THB: 'Thai Baht',
  TRY: 'Turkish Lira',
  USD: 'United States Dollar',
  ZAR: 'South African Rand'
}
*/

})();

License

exchain is licensed under the MIT License. See the LICENSE file for details.

Support

Discord Banner