Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@brixtol/currency-codes

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brixtol/currency-codes

Mappings for 2 letter (Alpha 2) country codes to 3 letter currency code.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@brixtol/currency-codes

Country codes (3166-1 alpha-2) to Currency (ISO 4217) code mappings used by the Brixtol Textiles internal API when dealing with pricing and currency conversions. Supports all 249 countries to currency maps.

Minified: 2.23 KB
Gzipped: 1.08 KB

Install

pnpm

pnpm i @brixtol/currency-codes

Because pnpm is dope and does dope shit.

npm

npm install @brixtol/currency-codes

Yarn

yarn add @brixtol/currency-codes

Usage

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

import { getCurrency } from "@brixtol/currency-codes";

// Country code SE (Sweden)
const sek = getCurrency("SE"); // SEK

// Country code NL (Netherlands)
const eur = getCurrency("nl"); // EUR

// Country code US (United States)
const eur = getCurrency("uS"); // 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 { Currencies, ICurrencies } from "@brixtol/currency-codes";

// Mapping Object

Currencies.SE; // SEK
Currencies.NL; // EUR
Currencies.RU; // RUB

// Interface

ICurrencies.SE; // SEK
ICurrencies.NL; // EUR
ICurrencies.RU; // RUB

The interface is identical to the mapping.

Currency code to currency symbol mappings:

Country code to country name mappings:

Currency code to currency.js symbol placement mappings:

License

Licensed under MIT


We open source!

Keywords

FAQs

Package last updated on 24 Oct 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc