Module:Currency

-- Shows currency information based on ISO 4217

local p = {} local getArgs = require("Dev:Arguments").getArgs local json = require("Dev:Json") local strupper = string.upper

function p.main(frame) local args = getArgs(frame) local currencyCode = strupper.args[1] local currencyInfo = args[2] return getCurrencyInfo (currencyCode, currencyInfo) end

function getCurrencyInfo(currencyCode, currencyInfo) local currencyDataset = json.decode(require("Dev:Currency/Common-currency.json")) local currencyData = currencyDataSet[currencyCode] if currencyData and currencyDataSet[currencyCode][currencyInfo] then return currencyDataSet[currencyCode][currencyInfo] end end

return p