Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mnowik/ember-currencies
List of currencies iso and symbol format
https://github.com/mnowik/ember-currencies
addon ember ember-addon ember-cli-addon npm
Last synced: 10 days ago
JSON representation
List of currencies iso and symbol format
- Host: GitHub
- URL: https://github.com/mnowik/ember-currencies
- Owner: mnowik
- License: mit
- Created: 2016-03-11T02:36:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-27T12:51:17.000Z (almost 6 years ago)
- Last Synced: 2024-11-16T17:22:46.237Z (about 1 month ago)
- Topics: addon, ember, ember-addon, ember-cli-addon, npm
- Language: JavaScript
- Size: 37.1 KB
- Stars: 2
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ember-currencies
[![npm version](https://badge.fury.io/js/ember-currencies.svg)](https://badge.fury.io/js/ember-currencies)A simple Addon that contains the 2 following lists:
- all the currencies in ISO3 (USD), ISO-Numeric (840), English name (United States dollar) formats and their symbol ($) if applicable.
- the currencies per country.Here are a list of the main helpers:
- Currency ISO3 or ISO-Numeric to Currency object.
- Country ISO2 to array of Currencies object (countries may have multiple currencies).You can find more information about ISO 4217 codes here:
- [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
- [Currency Authority](http://www.xe.com/iso4217.php)## Installation
* `ember install ember-currencies`
## Usage
### All imports
```js
import { CURRENCIES_LIST, CURRENCIES_PER_COUNTRY_LIST } from 'ember-currencies';
import { getCurrency, getCurrenciesForCountry } from 'ember-currencies';
import defaultEmberCurrencies from 'ember-currencies';
```### Example 1: currencies lists
```js
import Em from 'ember';
import { CURRENCIES_LIST } from 'ember-currencies';export default Em.Controller.extend({
CURRENCIES_LIST: CURRENCIES_LIST,
...
});
```### Example 2: currencies properties
```js
import Em from 'ember';
import { getCurrency } from 'ember-currencies';export default Em.Controller.extend({
currencyHelper() {
let expect = {name: "United States dollar", iso3: "USA", isoNumeric: "840", symbol: "$"};
let currency1 = getCurrency('USD');
let currency2 = getCurrency('840');
currency1 === expect // true
currency2 === expect // true
},
...
});
```### Example 3: Currencies per country lists
```js
import Em from 'ember';
import emberCurrencies from 'ember-currencies';export default Em.Controller.extend({
US_STATES: emberCurrencies.CURRENCIES_PER_COUNTRY_LIST,
...
});
```### Example 4: states properties
```js
import Em from 'ember';
import { getCurrenciesForCountry } from 'ember-currencies';export default Em.Controller.extend({
currencyHelper() {
let expect = {name: "United States dollar", iso3: "USA", isoNumeric: "840", symbol: "$"};
let currency = getCurrenciesForCountry('US');
currency === expect // true
},
...
});
```
## Running Tests* `npm test` (Runs `ember try:each` to test your addon against multiple Ember versions)
* `ember test`
* `ember test --server`## Building
* `ember build`
For more information on using ember-cli, visit [http://ember-cli.com/](http://ember-cli.com/).
## Contributing
PRs welcome!