🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@brixtol/currency-symbols

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brixtol/currency-symbols

Mappings from 3 letter currency codes to currency symbol

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

@brixtol/currency-symbols

Currency (ISO 4217) 3 letter code mappings to Currency symbol. used by the Brixtol Textiles internal API when dealing with currency conversion and presentation locales.

Size

Minified: 1.52 KB
Gzipped: 976 B

Install

pnpm

pnpm i @brixtol/currency-symbols

npm

npm install @brixtol/currency-symbols

Yarn

yarn add @brixtol/currency-symbols

Usage

You can pass in a currency code that is lowercase, uppercase or a mixture of both.

import { getCurrencySymbol } from "@brixtol/currency-symbols";

// Currency code SEK (Krona)
const sek = getCurrencySymbol("SEK"); // Kr

// Currency code EUR (Euros)
const eur = getCurrencySymbol("eur"); // €

// Currency code USD (Dollar)
const usd = getCurrencySymbol("uSd"); // $

The module also exposes the raw mappings and interface on the export. The mappings object is provided read only using Object.freeze. The raw mappings are annotated with JSDoc comments so when using an editor that supports intellisense (ie: vscode) you will receive the country and currency name in completions and hovers.

import { CurrencySymbols, ICurrencySymbols } from "@brixtol/currency-symbols";

// Mapping Object

CurrencySymbols.SEK; // kr
CurrencySymbols.EUR; // €
CurrencySymbols.RUB; // ₽
CurrencySymbols.USD; // $

// Interface

ICurrencySymbols.SEK; // kr
ICurrencySymbols.EUR; // €
ICurrencySymbols.RUB; // ₽
ICurrencySymbols.USD; // $

The interface is identical to the mapping.

Crypto Mappings

The module supports 4 crypto currency mappings. Only cryptos that have alt-codes are supported, please submit a PR if any are missing.

  • BTC (Bitcoin)
  • ETH (Ethereum)
  • LTL (Litecoin)
  • XBT (Bitcoin)

Country code to currency code mappings:

Country code to country name (English) mappings:

Currency Symbol placements (use with currency.js)

License

Licensed under MIT

We ♡ open source!

Keywords

currency

FAQs

Package last updated on 09 Sep 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