Module:Vanguard funds

-- Module to lookup and validate Vanguard mutual funds and ETFs. -- Example usage: --  -- Console example: --  mw.log(p.lookup({fund="0585"})) -- Notes: --  Input fund may be a fund symbol, an ETF ticker, or a fund number.

require('Module:No globals')

local p = {} local arguments = require('Module:Arguments')

local _lookup_table = mw.loadData('Module:Vanguard funds/data')

function p._lookup(args) local fund = (args["fund"] or args[1] or ""):lower

local result = _lookup_table[fund] if result then return result end

local title = mw.title.getCurrentTitle if title.namespace == 0 then return "undefined" .. ""	else return "undefined" .. ""	end end

function p.lookup(frame) local args = arguments.getArgs(frame, {trim = false, removeBlanks = false}) return p._lookup(args) end

return p