Socket
Book a DemoInstallSign in
Socket

current-currency

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

current-currency

Making it easy to work with currencies and cryptos!

latest
Source
npmnpm
Version
1.6.2
Version published
Weekly downloads
33
-72.5%
Maintainers
1
Weekly downloads
 
Created
Source

current-currency 💵💶💷

Making it easy to work with currencies and cryptos!

Summary

  • Getting Started
  • Available functions
  • Supported currencies
  • Supported cryptocurrencies

Getting Started

Install current-currency with your favourite package manager.

  • npm install current-currency
  • yarn add current-currency

Available functions

convert

Convert is used to get the current rates of a currency.

Example

import { convert } from "current-currency";

convert("EUR", 10.2, "USD").then(res => console.log(res));
// {currency: "USD", amount: 12.35}

In the background we make use of https://exchangeratesapi.io/ to always have the current rates.

addSymbol

AddSymbol is used to add the right currency symbol in the right position using the ISO currency code.

Example

import { addSymbol } from "current-currency";

const symbolized = addSymbol("RUB", 10.2);
console.log(symbolized);
// ₽10.2

Example with force position

import { addSymbol } from "current-currency";

const symbolized = addSymbol("USD", 10.2, "post");
console.log(symbolized);
// 10.2$

extract

Extract is used to retrieve information about a currency using the ISO currency code.

Example

import { extract } from "current-currency";

const extraction = extract("10.2RUB");
console.log(extraction);
// { type: "currency", name: "Russian ruble", symbol: "₽", decimal: ",", position: "pre" }

Supported currencies

CodeName
EUREuro
USDUnited States Dollar
CADCanadian Dollar
HKDHong Kong Dollar
ISKIcelandic Króna
PHPPhilippine Peso
DDKDanish Krone
HUFHungarian Forint
CZKCzech Koruna
AUDAustralian Dollar
RONRomanian Leu
SEKSwedish Krona
IDRIndonesian Rupiah
INRIndian Rupee
BRLBrazilian Real
RUBRussian Ruble
HRKCroatian Kuna
JPYJapanse Yen
TBHThai Baht
CHFSwiss Franc
SGDSingapore Dollar
PLNPolish złoty
BGNBulgarian Lev
TRYTurkish Lira
CNYChinese Renminbi
NOKNorwegian Krone
NZDNew Zealand Dollar
ZARSouth African Rand
MXNMexican Peso
ILSIsraeli Shekel
GBPPound Sterling
KRWSouth Korean Won
MYRMalaysian Ringgit

Supported cryptocurrencies

CodeName
BTCBitcoin
ETHEthereum
LTCLitecoin
XRPRipple
DOGEDogecoin

Keywords

currency

FAQs

Package last updated on 02 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.