23 lines
552 B
JavaScript
23 lines
552 B
JavaScript
// Pull latest from: http://www.currency-iso.org/en/home/tables/table-a1.html
|
|
// Convert to JSON at: http://www.csvjson.com/csv2json
|
|
|
|
const currencies = require('../data/currencies.json')
|
|
|
|
function goodCurrency (currency) {
|
|
const code = currency.code
|
|
return code.length === 3 && code[0] !== 'X'
|
|
}
|
|
|
|
function simplify (currency) {
|
|
return {
|
|
code: currency['Alphabetic Code'],
|
|
display: currency['Currency']
|
|
}
|
|
}
|
|
|
|
function toElmItem (currency) {
|
|
return `{ code = "${currency.code}"
|
|
, display = "${currency.display}"
|
|
, searchWords = []
|
|
}`
|
|
}
|