This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

function export.get_language_by_prefix(frame)
	local prefix = frame.args[1]
	if not prefix or prefix == "" then
		return
	end
	
	local Map = require "Module:User:Erutuon/lang_stuff/map"
	local name_to_code = require "Module:languages/canonical names"
	
	local lower, find
	if prefix:find("[\128-\255]") then
		lower, find = mw.ustring.lower, mw.ustring.find
	else
		lower, find = string.lower, string.find
	end
	
	return require "Module:JSON".toJSON(Map:new(name_to_code)
		:filter(function (code, name)
			return find(lower(name), "^" .. prefix) ~= nil
		end)
		:map(function (code, name)
			return { name, code }
		end)
		:values())
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:languages/javascript-interface/sandbox&oldid=55041" වෙතින් සම්ප්‍රවේශනය කෙරිණි