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

@y2nk4/currency-converter

v1.1.0

Published

A currency converter based on currencyconverterapi.com's api

Downloads

9

Readme

node-currency-converter

A currency converter based on currencyconverterapi.com's api

Build Status Coverage Status

About

Feature

:fire: Support most of the currency

:smiley: Using Promise

What is this module doing?

This module is based on currencyconverterapi.com, it will request this api to get the exchange rate between two currency.

You can get the api key from free.currencyconverterapi.com

The key used in the example is an example key from currencyconverterapi.com. But according to currencyconverterapi.com, you MUST NOT use this key, and it will get you banned.

Install via npm

npm i @y2nk4/currency-converter

Examples

let CurrencyConverter = require('@y2nk4/currency-converter')

// Please don't use this sample API key in your environment. 
// Doing so will get you banned.
// You may get your free API key at free.currencyconverterapi.com
let converter = new CurrencyConverter('do-not-use-this-key')

converter.convert('USD', 'CNY', 100)
    .then(console.log, console.error)

// returns 654.0698
const func = async () => {
    let audValue = await converter.convert('USD', 'AUD', 1, false, '2019-12-26')
    console.log(audValue)
}
func()

// returns 1.439797

Methods

convert(fromCurrency, toCurrency, [baseAmount = 1.0], [isRaw = false], [date])

  • fromCurrency - three-digit currency code for currency you want to convert from, ex: USD
  • toCurrency - three-digit currency code for currency you want to convert to, ex: CNY
  • baseAmount - the amount you want to exchange, float, default: 1.0
  • isRaw - set it to be true if you want it to return raw data from the api, default: false
  • date - historical single date for data to be pulled from, ex: 2020-07-15

This method returns the conversion amount in a float number

  • conversion_amount - Float Number if isRaw set to be false