1.3.0 • Published 2 years ago

@cashmoney/iso-currencies v1.3.0

Weekly downloads
8
License
MIT
Repository
github
Last release
2 years ago

CashMoney ISO Currencies

This library provides an up-to-date list of ISO 4217 currencies as provided by the official ISO maintenance agency. It uses the resources on the website of the maintenance agency to update this package.

There are three sets of data you can use from this library, consumable as both JSON and an ES Module. The latter should assist with tree-shaking, if that is important to you.

This package does not include any actual source code out of the box. The code that is in the repository exists solely for preparing updates to the provided data.

Install

With yarn:

$ yarn add @cashmoney/iso-currencies

Or with npm:

$ npm add @cashmoney/iso-currencies

Usage

Most of the time, you'll want to use the current list of currencies:

import { AUD, EUR, JPY, USD } from "@cashmoney/iso-currencies/resources/current";

console.log(AUD.minorUnit); // 2
console.log(EUR.currency) // 'Euro'
console.log(JPY.minorUnit); // 0
console.log(USD.alphabeticCode) // 'USD'

You can also access this list as a JSON file:

import fs from "fs";

const jsonData = fs.readFileSync("node_modules/@cashmoney/iso-currencies/resources/current.json", "utf8");
const data = JSON.parse(jsonData);

console.log(data.AUD.currency); // 'Australian Dollar'
console.log(data.EUR.alphabeticCode) // 'EUR'
console.log(data.JPY.numericCode); // 392
console.log(data.USD.minorUnit) // 2

The following is the full list of datasets available in this package:

all.js
all.json
current.js
current.json
historic.js
historic.json

Development notes

To prepare a new update, run yarn run fetch-update in the root of the repository.

Acknowledgements

The setup of this repository is inspired by the matching package in the MoneyPHP organisation:

https://github.com/moneyphp/iso-currencies

1.3.0

2 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago